C Programming - Typedef - Discussion

King said: (Aug 30, 2011)  
Error will Be like this
" Undefined symbol sdata"

Jim Rucker said: (May 12, 2012)  
From Microsoft's C compiler:

'{' : missing function header (old-style formal list?)

I don't know what compiler would see a random { in your global space without a compile error.

Peter Arnt said: (Aug 22, 2013)  
I maintain that the initial error is in the first line.

typedef struct data; <---<<<

You have a semicolon here which yields an incomplete typedef statement.

This causes the '{' on the next line to trigger more errors.

The fact that 'sdata' is not defined is the least of your troubles.

Whoever created this test should be re-tested themselves.

Om Prakash said: (Nov 12, 2013)  
Error will be:

Undefined symbol sdata.
Because the block will be treated differently and sdata differently.

Supraja said: (Mar 3, 2015)  
What is the purpose of typedef?

Gokila said: (Aug 12, 2015)  
Typedef is a keyword. The purpose of typedef is to assign alternative names to existing types, most often confusing, or likely to vary from one implementation to another.

Ronja said: (May 4, 2016)  
When I tried the error will be like this:

6:16: warning: 'typedef' was ignored in this declaration
7:1: error: expected unqualified-id before '{' token
10:2: error: 'sdata' does not name a type

How to rectify this?

Vijay Jeyakumar said: (Sep 3, 2016)  
I can't understand still. Please clarify me.

Arie1 said: (Sep 13, 2016)  
In visual C++ give those:

Warning C4091: 'typedef ': ignored on left of 'main::data' when no variable is declared.

Error C2065: 'sdata': undeclared identifier.

Error C2065: 'b': undeclared identifier.

Error C2065: 'sdata': undeclared identifier.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.