C :: Language Syntax Checking

Jun 15, 2013

Q. In context of C language syntax checking, which of the following can be modeled using Finite Automata?

(A) Detecting proper termination of an instruction.
(B) Detecting balance of parentheses.
(C) Detecting initialization of a variable.
(D) None of the above.

View 4 Replies


ADVERTISEMENT

C :: How To Program A Virus With Language

Oct 3, 2013

i'm student in computing science , i want to specialize in IT security and the first step i think is to know how to program a virus and understand how it works and how to stop it now i'm just a beginner I look for a way forward , i need some tips where can i begin? What are the basics of IT security? What programming language should I learn?

View 3 Replies View Related

C :: USB To Serial Communication Using Language

Dec 18, 2013

I have to communicate between two laptops using USB-to-Serial adapter. I have written 2 programs one for sending and another for receiving. Programs were written in both C and C# programming languages.

Using C language: I am able to successfully communicate using C-Programs mentioned below. But the problem is speed. It takes around 1 hour(60min) for just to pass 150MB. improving the performance of this programs...I also mention some comments along with programs for self understanding.Sender File on laptop with serial port :

Code:

#include <stdio.h>
#include <bios.h>
#include <conio.h>
}

[code]....

The above 4 programs behaves as, sender send a character and receives an ack for every character. I have followed this approach, bcoz other approaches were not working fine (in the sense the complete data is not sent, the amount of data sent is not judgeable, bcoz it will different every tym). when i used this approach it worked fine.

View 6 Replies View Related

C++ :: Compilation In Machine Language

Jan 25, 2013

Have a program which given a C source code file, gives back RAW MACHINE CODE, which means it doesn't have to be a executable on his own.

Like:

Given a example function for C:

int stdcall Function(void)
{
return 0;
}

Gives back the Machine Code for the Example Function.

It doesn't need to be actual C code, it can also be like:

type int
return 0

Or also it can be a straight assembly-to-machine-code compiler.

Is there any Library? Or even a external tool I can look into?

View 4 Replies View Related

C :: Opening Audio File Using Language

Sep 6, 2013

how to open an audio file using c. write a code to open an audio file.

View 2 Replies View Related

C :: Convert Decimal To Binary On Language

Nov 15, 2013

The goal of my program is to convert a decmial number to a binary number.First, the program gets an input to an array of chars, and the function translate_dec_bin converts this array to a decimal number through the strtoul function.The problem is that my program prints the binary number with an additional "0".For exmaple, for the input 1 - the program prints 01 instead of 1, for the input 3 - the program prints 011 instead of 11.

Code:

#include <stdio.h>
#include <stdlib.h>
#define MAX_LEN 20
void translate_dec_bin(char s[]){
char st[sizeof(unsigned)*20] = { 0 };
}

[code]....

View 2 Replies View Related

C++ :: Writing Simple Compiler For A Language

Mar 13, 2014

I have a problem about compiler.I want to write a simple compiler for a language.

stm -> id := expr
| print expr
| if expr then stm
| while expr do stm
| begin opt_stmts end

[Code] .....

I guess I should create main.c to convert source code.Also,I should create a source.c to write a example program that is relevant with above grammar.

View 1 Replies View Related

C/C++ :: Automata - Tell Whether A String Is Accepted By Language

Sep 27, 2014

I have a program that reads a text file and then outputs the corresponding transition table according to the regular expression given in the text file. The first line that is read by the code contains the transition table. The subsequent lines of the text files include the strings. I want my code to read the strings in the subsequent lines of the text file and tell me whether the string is accepted or not by the language. Basically, what my code does is that it translates the regular expression to an NFA and then, it translates the NFA to a DFA and then it builds a transition table according to the language.

I have included a special library in my code and I compiled my code from the command line using the following command:

gcc -o lalab lalab.c -lncurses
then, I just run the program like this:
./lalab

Another problem that I have is that my code does not handle the empty transitions, so the program should output a corresponding result when it is fed a regular expression such as a|e. The alphabet of the language is made of {a, b, e} e is the empty transition. The text file that the program reads from includes a regular expression in its first line and strings to be accepted or not in the following lines. Given an input file like this:

(a|b)*a
aaaa
aba
bba
ab
bbb
:frown:

The code should produce an output like this:

yes
yes
yes
yes
no
no

Code:
#include<stdio.h>
#include<conio.h>
#define MAX 20

//=========================================================
struct nfa_state {
int a, b, eps1, eps2;
}NFA[20];

[Code] .....

View 8 Replies View Related

C/C++ :: Vector Outputs Alien Language?

Oct 19, 2014

Program:I have 2 arrays: 1 for the correct answers to a quiz, 1 for the user. I then have a vector to hold the incorrect answers.

It keeps outputting what looks like alt characters, why.

Here is the code:

#include <iostream>
#include <vector>
using namespace std;
int main() {
const char a1[]={'a','d','b','b','c','b','a','b','c','d','a','c','d','b','d','c','c','a','d','b'};
char a2[20];
int i=0;
int incorrect=0;

[code].....

View 1 Replies View Related

C/C++ :: What Settings Has To Be Made To Run Language In Jgrasp

Nov 25, 2012

Running c in jgrasp.. i am getting error has gcc not found.

View 4 Replies View Related

C :: How To Convert Assembly Language In Txt File To S19 Format

Apr 25, 2013

a few pointers in building an assembler in C for a 68hc11 micro controller I'm struggling on a way to convert the assembly language in a txt file to s19 format.

View 1 Replies View Related

C# :: Way To Build Project To Dynamic Linking Language

Dec 28, 2011

I have a project C# and i want to build it to .dll for use in ASP.Net project . Any way to do it. It look like my attachments image .

View 1 Replies View Related

C++ :: Create Symbol Table For Assembly Language?

Jan 21, 2013

how to create a symbol table for an assembly language and high level language program in c++

View 1 Replies View Related

C :: Language Program Environment Does Nothing To Prevent Buffer Overflows

Sep 25, 2013

TheC language program environment does nothing to prevent buffer overflows ..... is there any pros to the obvious cons of this?

View 3 Replies View Related

C++ :: Create Symbol Table For High Level Language?

Jan 21, 2013

How to create a symbol table for an assembly language and high level language in c++?

View 1 Replies View Related

C :: Syntax Error In Expression Near If

Feb 3, 2013

I am using code::blocks for c programming and when i take debugger in below code it show ..

a syntax error in expression near "if"..

I am just checking debugger ...

Code:
#include <stdio.h>
#include <string.h>
int main()
{
char s1[100];

[Code] ....

View 7 Replies View Related

C/C++ :: Do While Loop Syntax Error

Feb 28, 2014

I am just starting out with loops and I have run into an syntax error and for the life of me I cant find out the issue. Before it has been an issue of me forgetting to close my brackets but I am pretty sure I did that this time. I am trying to have the program keep looping the main menu until the user inputs a correct number.

float total_Bal = 0.00;
char user_Choice;
do
{

[Code]....

View 6 Replies View Related

C/C++ :: Syntax Of Function Passing?

Feb 5, 2014

I'm familiar with function pointers as the method to pass a function as an argument to another function. However, I recently encountered some other syntax. I have seen in multiple times and in books,so I know it is probably not a syntax error. But I am not totally sure.

#include <iostream>
void Function1() { std::cout << "Function1"; }
void Function2(void aFunction()) { aFunction(); }
// make a param that describes the function the will be given
// as a param (return type, identifier,

[Code].....

View 4 Replies View Related

C++ :: Declaration Syntax Error

Apr 20, 2012

I keep getting a "Declaration syntax error" at line ""int main()". Is there something wrong with my int main()? And how do I go about it? Here is the program:

#include<stdlib.h>
#include<iostream.h>
#include<stdio.h>
#include<math.h>
#include<conio.h>
float rung4(float x, float y, float h)
int main() {
float eps=0.00001;

[Code] .....

View 14 Replies View Related

C++ :: Syntax Error If Statement

Feb 19, 2012

I got syntax error in if statement ,, i checked the line i put { after the condition don't know where the mistake are

1>c:usershani est11 est11code.cpp(20) : error C2143: syntax error : missing ';' before 'if'

PHP Code:

# include <iostream>
using namespace std;
int seqsearch (int list[],int length,int key);
void main () {
    int marks [30];

[Code] ....

View 2 Replies View Related

C++ :: Variadic Template Basic Syntax

Jul 31, 2014

I had to learn how to use variadic templates recently, and had trouble finding simple examples that just showed the basic syntax.

So I decided to write one myself. Admittedly, it's a bit on the long side, but that is mostly because it includes five specializations.

insert Code:
// Variadic.C
// Compile command: g++ Variadic.C -std=c++0x
// I used GCC version 4.6.3 on Ubuntu.

// This file contains a basic variadic template with five specializations.
// It is intended for non-software engineers who are looking for a simple
// example of variadic template syntax.

[Code] ....

View 3 Replies View Related

C :: Random Number Syntax In A Struct

Jan 18, 2014

I can’t figure out the syntax on how to generate random numbers for two members of a struct. It seems so simple because I know what I want to do, I just can’t make it work. I have the random generators I want but I don’t know how to pull it over into my struct.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct student {
int id;
int score;

[Code] ....

View 5 Replies View Related

C++ :: Syntax For Declaring Two-way Friendship In 2 Classes?

Feb 24, 2013

What is the general syntax for declaring two-way friendship in 2 classes?

View 1 Replies View Related

C++ :: Vector Syntax - Resize And Reserve

Mar 7, 2014

We can construct vector in following ways

vector<int>v1; //create an empty vector
vector<int>v2(arr,arr+4); ///to create vector from an array
vector<int<v3(v2); //throuh copy constructor

But I have come across some program in a forum,they have create vector like this

vector<int>v(10,5)

I am clueless ,is this allowed?,what syntax allows this?

if a vector is create like this

vector<int>v(3);
v.push_back(1);
v.push_back(2);
v.push_back(3)
v.resize(2);

Now I am curious to know what are the changes those will happen in vector v because of resizing it?

View 1 Replies View Related

C++ :: Syntax To Use vector Within Struct?

Apr 9, 2014

What is the proper syntax to use a vector within a struct? Here's an example of what I want to do:

#include<iostream>
#include<string>
#include<vector>
using namespace std;
struct myStructure {
float number;
vector<string> nameList();

[Code] ....

There must be some way to clear that vector. Why this doesn't work?

View 2 Replies View Related

C/C++ :: Dynamic Array Of Pointers Syntax?

Sep 23, 2014

I know that the synatx for a dynamic array of values is, for example:

int* a = new int[size];

And i understand that "a" is a pointer to the 1st element of the array on the heap.

Now, the syntax for a dynamic array of pointers is:

int** b = new int*[size];

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved