About the C category

Welcome to the C category. This is a space to ask any C questions, discuss exercises from the Exercism C track, or explore any other C-related conversations!

sir help me to solve helloworld using c language

It is actually quite a weird exercise because the solution is not what most would think of as C hello wordl.
The solution is to return a const string literal which is evaluated as a pointer… I find the exercise not only not very helpful and even a bit misleading.

I was expecting something like :

#include <stdio.h>

int main(void)
{
	puts("Hello World");
}
1 Like

The puts() function doesn’t return “Hello, World!”, though. It returns a non-negative integer if it was successful or EOF, if it wasn’t. That’s why it wouldn’t be the solution. The solution is to return “Hello, World!” as a string, which in C is an array of chars. That’s why there is a pointer, since it points to the first character of the array of chars. If you already knew all this, then I apologize. I’m just trying to help.

It is indeed because the exercise itself is not “Hello, World!”

This exercise is about familiarity (orientation) of the platform itself, more than an excercise for learning the language.

Well then maybe let’s not call that exercise “Hello World” so that people familiar with the Hello World exercise don’t get confused ?

I really don’t understand the point of the exercise nor the need to for a “get familiar with the platform” exercise.

1 Like