0% found this document useful (0 votes)
47 views

What Will The Preprocessor Do For A Program

1) The C preprocessor modifies source code by performing macro substitution, including header files, and evaluating conditional compilation directives. 2) It is invoked as the first part of compilation and creates a preprocessed version of the source code before compilation. 3) The preprocessed version has macros replaced by their defined values and includes all specified header files and conditionally compiled code.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

What Will The Preprocessor Do For A Program

1) The C preprocessor modifies source code by performing macro substitution, including header files, and evaluating conditional compilation directives. 2) It is invoked as the first part of compilation and creates a preprocessed version of the source code before compilation. 3) The preprocessed version has macros replaced by their defined values and includes all specified header files and conditionally compiled code.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

What will the preprocessor do for a program

The C preprocessor is used to modify your program according to


the preprocessor directives in your source code. A preprocessor
directive is a statement (such as #define) that gives the
preprocessor specific instructions on how to modify your source
code. The preprocessor is invoked as the first part of your
compiler program?s compilation step. It is usually hidden from
the programmer because it is run automatically by the compiler.

The preprocessor reads in all of your include files and the source
code you are compiling and creates a
preprocessed version of your source code. This preprocessed
version has all of its macros and constant
symbols replaced by their corresponding code and value
assignments. If your source code contains any
conditional preprocessor directives (such as #if), the
preprocessor evaluates the condition and modifies your source
code accordingly.

preprocessor do:1>macro substitution


2>multiple spaces into one
3>including all header files
4>include all conditional compilations
5>removing the comment lines

What is a macro, and how do you use it?

A macro is a preprocessor directive that provides a mechanism


for token replacement in your source code. Macros are created
by using the #define statement.

Here is an example of a macro: Macros can also utilize special


operators such as the stringizing operator (#) and the
concatenation operator (##).The stringizing operator can be
used to convert macro parameters to quoted strings, as in the
following example:

#define DEBUG_VALUE(v) printf(#v ? is equal to %d.n?, v)

In your program, you can check the value of a variable by


invoking the DEBUG_VALUE macro:

...
int x = 20;
DEBUG_VALUE(x);
...

The preceding code prints ?x is equal to 20.? on-screen. This


example shows that the stringizing operator used with macros
can be a very handy debugging tool.

What is :- Asembler , compiler , Preprocessor , laxical


analysis , parsing ?

ASSEMBLER is a computer program which converts the assembly


language program into machine level language.
COMPILER is a progam or set of programs which converts the
high level language into machine level language.
PREPROCESSOR is a computer program that processes input to
produce an output which again serves as a input to another
program.
LEXICAL ANALYSIS is the process of converting a sequence of
characters into a sequence of tokens.

PARSING is the process of analyzing a sequence of tokens to


determine their grammatical structure.it is also called as
syntactic analysis.

how to create love flames program using c language


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,j,n,c,s=0,p,t,y;
char a[25],b[25],m,q[25],w[25];
clrscr();
printf("Enter Ur Name
");
scanf("%s",a);

printf("Enter Ur Partner's Name


");
scanf("%s",b);
strcpy(q,a);
strcpy(w,b);
n=strlen(a);
c=strlen(b);
for(i=0;i<n;i++)
{
m=a[i];
for(j=0;j<c;j++)
{
if(m==b[j])
{
a[i]=-1;
b[j]=-1;
s=s+2;
break;
}
}
}
p=n+c;
puts(a);
puts(b);
t=p-s;
printf("The count value is %d",t);
if(t==2 || t==4 || t==7 ||t==9 )
printf("
%s is ENEMY to %s ?,q,w);
else if (t==3 || t==5 || t==14)
printf("
%s is FRIEND to %s ",q,w);
else if(t==6 || t==11 || t==15 )
printf("
%s is going to MARRY %s ?+?",q,w);
else if(t==10)
printf("
%s is in LOVE with %s ",q,w);
else if(t==8)
printf("
%s has more AFFECTION on %s ",q,w);
else
printf("
%s and %s are SISTERS/BROTHERS ",q,w);
getch();
}

Can multiple catch blocks be executed

No, once the proper catch code fires off, the control is
transferred to the finally block (if there are any), and then
whatever follows the finally block.

once an error is occured ,it caught the corresponding execption.

but we can define multiple catch along with a single


try...runtime it execute the specific catch block

eg:

try
{
int i=0;
int j=10/i;
}
catch(DivideByZeroException ex)
{
}
catch(execpetion ex)
{}

Posted by: Priya    

Contact Priya

No only one catch u can use for one try block after that it will go
to the finally block

What are the applications and advantages of C-language?

1.'C' is the only intermediate programming language in between


low level and high level programming language.

2.All applications written in "C" will be executed fast.

3.All aeronautical applications , mission critical applications are


written in "C".
4.Embedded programming is written in "C".

What is the use of semicolon at the end of every


statement?

If semicolon comes in a statement means its ending point of the


statement.

As we know that C is a free form language, semicolon is the only


symbol that tells compiler about the end of a statement. No other
symbol can be used for marking the end of a statement.

What is the difference between compile time error and run


time error?

Compile time is semantic and syntax error, whereas run time is


memory allocation error e.g. segmentation fault.

When we access the integer and the character variables


without declaring them in program?and Why?

if the variable is declared as global in another program & dat


prog is used in the current prog with the help of #include<>
stat, then accessing of undeclared variables is possible.....

What are the features of C?

c is not case sensitive and middle level language

Pointers,structures,unions,arraysfile handling

What are the characteristics of arrays in C?


Category

) An array holds elements that have the same data type

2) Array elements are stored in subsequent memory locations

3) Two-dimensional array elements are stored row by row in


subsequent memory locations.

4) Array name represents the address of the starting element

5) Array size should be mentioned in the declaration. Array size


must be a constant expression and not a variable.

6)While declaring the 2D array, the number of columns should


be specified and its a mandatory. where as for number of rows
there is no such rule.

Example:
#include <stdio.h>
int main()
{
int arr[][2]={1,2,3,4,5,6,7,8};
//where as int arr[4][]={1,2,3,4,5,6,7,8}; gives the error.Coz
here compiler gets confuse how much space to allocate to
column of a row.

int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<2;j++)
printf("%d ",arr[i][j]);
printf("
");
}
getch();
}

Output:
12
34
56
78

What is the difference between

#include< >
and
#include" "

General Convention for this notation is:

# include < > ---> Specifically used for built in header files.

# include " " ----->Specifically used for used for user


defined/created n header file

How can we use data connectivity in Difference between


"C structure" and "C++ structure". 'c' languag ?

1)By default,c structure is public and c++ struecture is private.


2)c++ structure contains member function whereas c structures
contains only data.

What are C and C++ languages?


c is the structure oriented language and c++ is object oriented
language .
c does not support classes and c++ support classes,inheritance

What is C language?

c language is a middle level language it is a user friendly


language

Using Pro *C we can do the data connectivity.e?

This is just the usage point of view. But from the compiler point
of view the #include" " will make compiler search only in the
local directory.

You might also like