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

why it not takes third value that b3.name = getchar();

$
0
0
#include<stdio.h>
struct Books
{
    char name;
};
int main()
{
    struct Books b1;
    struct Books b2;
    struct Books b3;
    b1.name = getchar();
    printf("%c\n",b1.name);
    b2.name = getchar();
    printf("%c\n",b2.name);
    b3.name = getchar();
    printf("%c\n",b3.name);
    return 0;

 }

/* "why it not takes third value that is b3.name = getchar(); but it works fine with int and float."

ahindra@ahindra:~/Documents/c_c++$ gcc test.c -o test ahindra@ahindra:~/Documents/c_c++$ ./test f f

j j ahindra@ahindra:~/Documents/c_c++$

*/


Viewing all articles
Browse latest Browse all 21994

Trending Articles



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