Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22048

How to print garbage values in c using loop [closed]

$
0
0

When I run the following program it prints a garbage value:

#include <stdio.h>int main() {    int a;    printf("%d\n", a);    return 0;}

But when I run this code that was intended for printing out ten garbage value is just printing zero one time. Why it is no longer showing any garbage value. I am using gcc compiler.

#include <stdio.h>int main() {    int i;    for (i=0; i<=0; i++) {        int a;        printf("%d\n", a);    }    return 0;}

I expected this code to show ten different garbage values.


Viewing all articles
Browse latest Browse all 22048

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>