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?
- warning: implicit declaration of function
- What is the difference between float and double?
- How do function pointers in C work?
- “Expected expression before ‘ { ‘ token”
- How to generate a random int in C?
- C pointers and arrays: [Warning] assignment makes pointer from integer without a cast
- How to print the array?
- How to solve the error: assignment to expression with array type
- segmentation fault : 11
- In C programming, what is `undefined reference`error, when compiling?
- Passing by reference in C
- double free or corruption (fasttop)
- #31 expression must have integral type
- How do you pass a function as a parameter in C?
- Simple C program to read a file line by line
- What is the cause of flexible array member not at end of struct error?
- Best C/C++ Network Library
- How can I get argv[] as int?
- Why I do get “Cannot find bound of current function” when I overwrite the ret address of a vulnerable program?
- Warning: assignment from incompatible pointer type
- How do malloc() and free() work?
- Using true and false in C
- C convert floating point to int
- Flushing buffers in C
- Undefined Reference issues using Semaphores
- What is time(NULL) in C?
- C++ – Too Many Initializers for Arrays
- Reading string by char till end of line C/C++
- How to use EOF to run through a text file in C?
- How can one see content of stack with GDB?
- Is there any difference between 1U and 1 in C?
- segmentation fault: 11 in C code
- Display number with leading zeros
- Proper way to empty a C-String
- malloc(): memory corruption
- Warning: X may be used uninitialized in this function
- Using OpenMP with clang
- Reaching EOF with fgets
- Difference between char* and char** (in C)
- What are the supported Swift String format specifiers?
- Implicit function declarations in C
- Convert long long to string in C?
- how to stop a loop arduino
- How to normalize a mantissa