5.4. Using the online compiler Enter the code:
#include <stdio.h>
#include <stdlib.h>
// Function prototype. Some compilers absolutely insist that function
// prototype(s) are present
void blah2(int *i);
// ===========================================================
// Function blah2()
//
// This takes a reference to a value i, increments it and displays it
//
// Returns the calculated voltage.
// ===========================================================
void blah2(int *i)
{
printf("In function: the value of *i is %d\n", *i);
(*i)++; // Equivalent to *i = *i + 1;
printf("In function: the value of *i after increment is %d\n\n", *i);
}
int main(int argc, char *argv[]) {
int num;
num = 3;
blah2(&num);
printf("In main(): the value of num is %d\n", num);
system("pause");
return 0;
}
• Run the program.
The answer to your question is provided in the image:
Comments
Leave a comment