-
-
What happens when we try to change the value of base address of the string?
The base address of the sting takes a special place in the context of strings. This is because suing this base address only the string gets identified. In other words the base address therefore takes the position of constant. As we all know it is not possible to change the value of constants so is the base address. Let us see this concept with the help of a small program. For instance consider the...
-
Why it is that the left hand side of assignment operator must have a variable?
It so because only a variable can have operation performed in it. To explain this concept more briefly let us see an example. Consider the following program: main() { int a=10; int b; b=sample(++a++); } sample(c) int c; { printf(“%d”,c); } The above program will not work and would give a error message as LValue Required. This is because of the statement sample(++a++). In...
-
What is difference between call by value and call by reference in function?
The arguments passed to function can be of two types namely 1. Values passed 2. Address passed The first type refers to call by value and the second type refers to call by reference. For instance consider program1 main() { int x=50, y=70; interchange(x,y); printf(“x=%d y=%d”,x,y); } interchange(x1,y1) int x1,y1; { int z1; z1=x1; x1=y1; y1=z1; printf(“x1=%d...
-
How to develop, compile and run a C program
The steps involved in building a C program are: 1. First program is created by using any text editor and the file is stored with extension as .c 2. Next the program is compiled. There are many compilers available say GNU C compiler called as gcc, Sun compiler, Borland compiler popular with PC system and so on. There are lots of options for compiling. Generally the compilation is done as below cc...