Edit:
I can’t reproduce the problem. Everything works as expected when I use the following code compiled with gcc:
#include <stdio.h> struct MyStruct { float p; } newMyStruct; int main() { scanf("%f", &(newMyStruct.p)); printf("%f\n", newMyStruct.p); }
The output of gcc –version is as follows:
gcc (Debian 4.7.2-5) 4.7.2
Related Posts:
- Reading float using scanf in c
- How to print an unsigned char in C?
- How do you allow spaces to be entered using scanf?
- How do you read scanf until EOF in C?
- How to repeat a char using printf?
- Simple C scanf does not work? [duplicate]
- How many spaces for tab character(\t)?
- Correct format specifier for double in printf
- Scanf/Printf double variable C
- Strings and character with printf
- printf() formatting for hexadecimal
- Printing hexadecimal characters in C
- What is the argument for printf that formats a long?
- What is the printf format specifier for bool?
- How to printf “unsigned long” in C?
- How I can print to stderr in C?
- Difference between scanf() and fgets()
- Is there a printf converter to print in binary format?
- Output single character in C
- Going through a text file line by line in C
- Reading a string with scanf
- What does “%.*s” mean in printf?
- Going through a text file line by line in C
- How to print a char array in C through printf?
- How to do scanf for single char in C
- What does %s and %d mean in printf in the C language?
- How to printf a memory address in C
- Data argument not used by format strings in C
- How can one print a size_t variable portably using the printf family?
- %i or %d to print integer in C using printf()?
- How can you print multiple variables inside a string using printf?
- error: aggregate value used where an integer was expected
- Scanning Multiple inputs from one line using scanf
- C’s printf and fprintf(stdout,) are not printing
- Is there a way to have printf() properly print out an array (of floats, say)?
- How to write to a file using open() and printf()?
- Using floats with sprintf() in embedded C
- Printf width specifier to maintain precision of floating-point value
- Which of sprintf/snprintf is more secure?
- Does C have a string type?
- Difference between fgets and fscanf?
- how use EOF stdin in C
- Execution of printf() and Segmentation Fault
- How to find EOF through fscanf?
- printf format specifiers for uint32_t and size_t
- Reading in double values with scanf in c
- How to display hexadecimal numbers in C?
- Two decimal places using printf( )
- How do you format an unsigned long long int using printf?
- How to read from input until newline is found using scanf()?
- What primitive data type is time_t? [duplicate]
- How to format strings using printf() to get equal length in the output
- How to format strings using printf() to get equal length in the output
- What do \t and \b do?
- What does %s mean inside a string literal?
- write() to stdout and printf output not interleaved?
- How big can a 64 bit unsigned integer be?
- The difference between n++ and ++n at the end of a while loop? (ANSI C)
- What is a segmentation fault?
- Implementing Taylor Series for sine and cosine in C
- Working on code to calculate cosine with factorial sum
- How to use execvp()
- How to use execvp() to execute a command
- How to format strings in Java
- How does strtok() split the string into tokens in C?
- warning: implicit declaration of function
- warning: implicit declaration of function
- What is *(uint32_t*)?
- What does (~0L) mean?
- pthread_join() and pthread_exit()
- What is size_t in C?
- What is the difference between float and double?
- what is Segmentation fault (core dumped)? [duplicate]
- What causes a segmentation fault (core dump) to occur in C?
- uint8_t vs unsigned char
- How to use symbols of extended ASCII table in C?
- Two questions about basic C programs
- What is the difference between ++i and i++?
- Using boolean values in C
- What does “collect2: error: ld returned 1 exit status” mean?
- How to convert an int to string in C?
- typedef struct vs struct definitions [duplicate]
- How to print in C
- What is the effect of extern “C” in C++?
- Why should we typedef a struct so often in C?
- Why are #ifndef and #define used in C++ header files?
- Arrow operator (->) usage in C
- strdup() – what does it do in C?
- strdup() – what does it do in C?
- What is a string of hexadecimal digits?
- Why should we typedef a struct so often in C?
- What exactly is the difference between “pass by reference” in C and in C++?
- What is the difference between ++i and i++?
- What can be the reasons of connection refused errors?
- What does “collect2: error: ld returned 1 exit status” mean?
- How to convert an int to string in C?
- typedef struct vs struct definitions [duplicate]
- What is newline character — ‘\n’
- When to use extern “C” in simple words? [duplicate]
- Floating point exception( core dump