0
0
Cprogramming~10 mins

Typedef keyword in C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a new type name for int.

C
typedef [1] MyInt;
Drag options to blanks, or click blank then click option'
Ainteger
Bint
Cfloat
Dchar
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'integer' instead of 'int' which is not a valid C type.
Confusing 'float' or 'char' with integer type.
2fill in blank
medium

Complete the code to create a new type name for a struct.

C
typedef struct [1] {
    int x;
    int y;
} Point;
Drag options to blanks, or click blank then click option'
APoint
Bpoint
CCoordinates
DCoord
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different name than the struct tag name.
Confusing the new type name with the struct tag.
3fill in blank
hard

Fix the error in the typedef declaration for a pointer type.

C
typedef [1]* IntPtr;
Drag options to blanks, or click blank then click option'
Aint*
BInt
Cint
Dpointer
Attempts:
3 left
💡 Hint
Common Mistakes
Including the asterisk inside the blank causing syntax errors.
Using undefined types like 'Int' or 'pointer'.
4fill in blank
hard

Fill both blanks to create a typedef for an array of 10 floats.

C
typedef [1] [2][10];
Drag options to blanks, or click blank then click option'
Afloat
Bint
CMyArray
DArray
Attempts:
3 left
💡 Hint
Common Mistakes
Using int instead of float for the array type.
Confusing the new type name with the base type.
5fill in blank
hard

Fill all three blanks to create a typedef for a function pointer that takes two ints and returns an int.

C
typedef [1] (*[2])([3], int);
Drag options to blanks, or click blank then click option'
Aint
BFuncPtr
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Using void as return type instead of int.
Confusing parameter types or missing the pointer syntax.