How to create a struct in C

how to create a struct in C problem You wish to represent a custom data type in your C program. In this post we will see how to represent a student object. A student is made of few pieces of information like a name, surname, age, etc. SOLUTION In C, we can use struct keyword […]

How to tokenize a string in C

how to tokenise a string in c problem You wish to extract tokens from a string using a delimeter. For example, a string that contains a line of code/ instruction and you wish to break it apart to further evaluate it. SOLUTION In C, we can find the strtok() function that helps us to break […]

Read a text file line by line in C

read a text file line by line in C problem You have a text file, for example a CSV file that you wish to read using the C programming language.  In this post we will see how to accomplish this. SOLUTION Let’s read the file line by line using the filesystem’s functions. The plan is […]