#Im a beginner in C and im having a trivial problem
45 messages · Page 1 of 1 (latest)
Hi there! Welcome to the forum. It looks like you're having a problem with C, which is great! To help you get the best answers, could you please provide more details about your issue? For example:
- What specific problem are you encountering?
- What code have you written so far?
- What error messages are you seeing (if any)?
Providing this information will help others understand your problem and offer more relevant solutions. Thanks!
- its not printing in new line
-
#include<stdio.h>
int main() {
int age = 18;
printf("Hello world \n");
printf("Age is %d \n", age);
return 0;
}
3. No errors, just logical issue
It looks like you're having trouble with your C code's output. The \n character is the newline character in C. It tells the program to move the cursor to the next line. Your code is already correct!
Here's the code you provided:
#include <stdio.h>
int main() {
int age = 18;
printf("Hello world \n");
printf("Age is %d \n", age);
return 0;
}
This code will print:
Hello world
Age is 18
If you're still having trouble, double-check your compiler and environment to make sure everything is set up correctly. If you have any other questions, feel free to ask!
1sec
okay
i'm not sure, it did print on a new line for me 🤔 What editor are you using?
im using vs code
did i not install C the right way or something?
@patent minnow your prompt not strong enough lol
Haha, I appreciate the feedback! I'm always learning and trying to improve my responses. Is there anything specific you'd like me to help you with regarding the bytes economy or squad management systems? Perhaps you have a question about a command or are running into an issue?
Did you save and recompile?
I installed the code runner extension and i right clicked the file name and hit "Run code"
is that good enough?
Uhhhhh I don't know how to use vs code
And I don't recommend using it to run your code
also on vscode
if you are on windows maybe doing \r before the n?
printf("Hello world\r\n");
printf("Age is %d\r\n", age);
why?
You should learn to compile and run your c code yourself and not rely on vscode doing it for you
Try use it then
but its just convenience reasons
Save your file and recompile
ill try
That's my gut instinct when you encounter a trivial issue like that lol
the recompile?
Wait so the extension i installed is the problem?
yea i did gcc and ./a.exe manually and it worked
but why is extension giving problems?
how can i fix it
wait wtf
its working well with that too
maybe i didnt save it and thats why its giving the problem?
possible
🔥
You gotta save and recompile whenever you want to run your code
Otherwise it'll always be an older one
Oooph I think small model too big system prompt 