Advertisements

Search results for auto

Example:[1]

            Write a program to demonstrate the use of auto/local and global variables in C programming
          

            #include <stdio.h>
int autoFunc(int );
int glbvar = 10;
int glbvar1;
int main() {
  printf("glbvar:%d,glbvar1:%d\n", glbvar, glbvar1);
  int autovar = 20;
  int res;
  printf("res is:%d\n", res);
  res = autoFunc(autovar);
  printf("res is:%d\n", res);
  return 0;
}
int autoFunc(int autovar)
{
  printf("0th block:%d\n", autovar);
  {
    auto int autovar = 30;
    printf("Ist block:%d\n", autovar);
    {
      auto int autovar = 40;
      printf("2nd block:%d\n", autovar);
    }
  }
  glbvar += autovar;
  return glbvar;
}
          

 Search Links


 Popular C search MCQs


 Popular C search examples