OK, some things I've spotted:
Code:
main()
{
char a;
int i=10;
printf(“\nThe value of i is %d”,i);
a=getchar();
if(a==’a’)
{
int i=1;
printf(“\nThe value of i is %d”,i);
}
printf(“\nThe value of i is %d”,i);
}
It should be "int main(void)", your way is the older K&R style. And "a" should be of type int to check for EOF (explain this further)
Code:
#include <stdio.h>
void multi_table(int i);
main()
{
int i;
multi_table(i);
printf("\nValue of i is %d",i);
}
void multi_table(int i)
{
printf("\n 1 x %d = %d",i,i*1);
printf("\n 2 x %d = %d",i,i*2);
printf("\n 3 x %d = %d",i,i*3);
printf("\n 4 x %d = %d",i,i*4);
printf("\n 5 x %d = %d",i,i*5);
printf("\n 6 x %d = %d",i,i*6);
printf("\n 7 x %d = %d",i,i*7);
printf("\n 8 x %d = %d",i,i*8);
printf("\n 9 x %d = %d",i,i*9);
printf("\n10 x %d = %d",i,i*10);
i=0;
}
"i" is garbage in main. You didn't initialize it. The "i = 0" statement changes only a _copy_ of i.
"The compiler would place variables of this type into the read‐only memory of the program." That's not guaranteed, const values can be changed by pointers:
Code:
const int i = 0;
int *pointer = &i;
*pointer = 10;
"Generally when a program is implied, the compiler optimizes certain expressions by assuming that a variable’s value is unchanging if it does not occur on the left side of an assignment".
Maybe that's correct and I'm a nerd, but i++ is not an assignment. And it may be changed by pointers.
"auto is used to create a variable, usually a temporary variable, within a block of code. The variable is only available to the block of code it has been defined within and cannot be referenced outside of the block of code in which it is being used."
Note that auto is the default.
In general you are using some bad coding practices. And compile your programs first with all warnings enabled.