S
Shinu George
I have two files like given below:
/* File 1 */
#include <stdio.h>
#include <stdlib.h>
void tf(void);
int i;
int main(void)
{
i = 10;
tf();
return EXIT_SUCCESS;
}
/* End File 1 */
/* File 2 */
#include <stdio.h>
int i = 48;
void tf(void)
{
printf("%d\n", i);
}
/* End File 2 */
The observed behaviour is that the "printf" always prints the value of i as 10.
Two questions:
1 (for clc). Is the above code standards (ANSI) compliant?
2 (for cup). How do I get the linker to "see" the i with value 48 on Solaris?
Thanks and regards,
Shinu
/* File 1 */
#include <stdio.h>
#include <stdlib.h>
void tf(void);
int i;
int main(void)
{
i = 10;
tf();
return EXIT_SUCCESS;
}
/* End File 1 */
/* File 2 */
#include <stdio.h>
int i = 48;
void tf(void)
{
printf("%d\n", i);
}
/* End File 2 */
The observed behaviour is that the "printf" always prints the value of i as 10.
Two questions:
1 (for clc). Is the above code standards (ANSI) compliant?
2 (for cup). How do I get the linker to "see" the i with value 48 on Solaris?
Thanks and regards,
Shinu