#need help figuring out the first c problem itself
32 messages · Page 1 of 1 (latest)
Did you watch that video?
i did
apparently i should not delete the given code and only make a single change
which i do not at all know
eh
so i just had to change bye to hello and mars to world
but now i have no idea how the function works
Which part of the function do you not understand?
If you copy/paste your code here, and spell out your confusion, someone may be able to explain things to you
well the code in itself is something i don't get, in the end i did this:
#include "hello_world.h"
const char *hello(void)
{
return "Hello, World!";
}
as to the change a single string reference but how the code works is a different thing and the part i don't get
Increase your chance of getting help and look like a pro by sharing codeblocks not images. For example, you can type the following. Note, the ``` must be on their own line.
```
for number in range(10):
total += number;
```
Discord will render that as so:
for number in range(10):
total += number;
Click here to learn more about codeblocks: https://exercism.org/docs/community/being-a-good-community-member/writing-support-requests and http://bit.ly/howto-ask
Do you understand any of the lines? Most of the lines? None of the lines?
@frozen wolf ?
im back i was awk for a while
//why are we accessing that?
const char *hello(void) // const char cause we are returning a constant character? but no idea about the next part
return part makes sense```
👋🏼 Hello!
Exercism is designed for people who have some experience in programming. If you are new to coding, we recommend joining our Beginners Bootcamp, starting in January: https://bootcamp.exercism.org
There are many other great resources online, that can kickstart your journey in computer science.
- Harvard's CS50x course is great for a wide understanding.
- Code in Place is a great intro to coding course which will teach you Python using their browser-based environment.
- For a focus on web development, try The Odin Projects. It is a long-term commitment that will guide you to through some projects and will leave you with a nice portfolio by the end.
- For web development, The MDN web docs are a valuable resource.
Header files are used to share what functions exist with other code files. It's part of how C code is compiled; each file is compiled itself but needs to know what other files contain. Header files are used to share this info.
https://www.geeksforgeeks.org/header-files-in-c-cpp-and-its-uses/
const char * is a "string" in C. void means this function takes no arguments.
Did I miss any part?
i get the void part so is hello the function name and since by default strings don't exist in c
we use the *
as a pointer to move to each character
* says we are dealing with a pointer to chars, which is how strings work in C, yes
okay i see
what about when we include stdio.h is that sort of inbuilt header thats there
stdio is part of the ... standard library that does IO stuff. Most languages come with a library of helpful functions you might want to use.
You're very welcome