-->
By

Array Variable (declared as Global) and changing the value inside a function -C programming 


#include<stdio.h>
 
 int a[3] ={10,15,20};  // declaring array variable as global 
int test_function();    // a function to change the array varriable value in side the function 
int main()
{
 
 int i,j;
 
 for(i=0;i<3; i++)
   printf("Inside the main function i = %d\n",a[i]);
 
 test_function();
 printf("\n\n");
 for(i=0;i<3; i++)
   printf("Inside the test  function i = %d\n",a[i]);
 return 0;
}

int test_function()
{
a[0] = 18;
a[1] = 100;
a[2] = 250;
 
return 0; 
}

Output and program image 

More Posts

gElectron. Powered by Blogger.

Contributors

16x2 LCD Interfacing with STM32,STM32F103C6

 16x2 LCD  Interfacing with STM32,STM32F103C6 lcd_init(); LCD_LINE1; lcd_String(" GeElectron"); LCD_LINE2; lc...

Contact Form

Name

Email *

Message *

Contact us

Name

Email *

Message *

Follow Us

https://www.facebook.com/gElectron-393939667321867/ FBbox/https://www.facebook.com/IVYthemes

Comments

[blogger]

MKRdezign

Test
google.com, pub-8429441124104529, DIRECT, f08c47fec0942fa0
[blogger]

Latest

[recent][newsticker]

Technology

Top Ads

RECENT COMMENTS

Subscribe Via Email

Subscribe to our newsletter to get the latest updates to your inbox. ;-)


Your email address is safe with us!

RECENT COMMENTS