Mohamed Ahmed
ok i got it
Mohamed Ahmed
thanks
coal
why a warning
coal
they're scambots
%Nikita
Indeed
As I remember in RayLib was some function like: DrawFPS(int x,int y);
Anonymous
As I remember in RayLib was some function like: DrawFPS(int x,int y);
Yes, there is, but I'd prefer drawing my own FPS counter for more customization
Anonymous
I discovered snprintf which allows me to specify the buffer size so it's safer
Anonymous
I'll just use it
𝐀𝐥𝐞𝐞𝐮🪐💰🕊️
Hello
𝐀𝐥𝐞𝐞𝐮🪐💰🕊️
Am new here
Dima
I thought this is malloc
Anonymous
How do I be a good app and web programmer Am not experienced Is that possible for me?
Tushar
Everything is possible, its just how much hard you are willing to work for it
Tushar
participate in hackathons and from people you can get to know which sites they refer to for getting to know about app and web programming
Anonymous
hey
Anonymous
can you correct this ?
Anonymous
#include <stdio.h> #include <conio.h> // C Program to find largest number among "n" numbers. int main() int i,n,num[100],max; printf("Enter the size of array:\n"); scanf("%d",&n); for (i=0;i<n;i++); { printf("Enter number \n"); scanf("%d",&num[i]) } max=num[0]; for (i=0;i<n;i++); { if(num[i]>max) max=num[i]; } printf("The largest number is %d",max); return 0; }
\Device\NUL
can you correct this ?
What's wrong ?
\Device\NUL
> printf("Enter the size of array:\n"); This part is wrong, you could have out of bound array access since the array size is 100
Anonymous
idk but the code isn't running
\Device\NUL
idk but the code isn't running
Just read the compiler message
Anonymous
Just read the compiler message
54Array.c [Error] expected declaration specifiers before 'printf'
\Device\NUL
54Array.c [Error] expected declaration specifiers before 'printf'
> for (i=0;i<n;i++); You don't need semicolon
\Device\NUL
Unless you're not writing curly bracket after it
Anonymous
oh , that's fine. but I mn't getting 5th line clearly.
\Device\NUL
Except functions prototypes
\Device\NUL
Next time use indentation
Anonymous
#include <stdio.h> #include <conio.h> // C Program to find largest number among "n" numbers. int main() int i,n,num[100],max; printf("Enter the size of array:\n"); scanf("%d",&n); for (i=0;i<n;i++) { printf("Enter number \n"); scanf("%d",&num[i]) } max=num[0]; for (i=0;i<n;i++) { if(num[i]>max) max=num[i]; } printf("The largest number is %d",max); return 0; }
Anonymous
so ok ??
ʙʀʜᴏᴏᴍ ⑇
Can we replace the word "main" with any other word!?
Dima
no on windows you can use winmain
Dima
(well actually you can, but its a totally different story)
Pavel
Hi, are you sure you don't want to explain your problem here?
Artur
Any attempt made to do it yourself?
klimi
That doesn't explain what problem you are having
coal
specify an entry point to the linker and compile without the standard runtime library
coal
Can you give me a sample example!!?
google "how to specify entry point in gcc/g++/clang"
ʙʀʜᴏᴏᴍ ⑇
google "how to specify entry point in gcc/g++/clang"
Okay bro Thank you for helping me ❤️🔥
Eliezer
so ok ??
Did you solve your problem?
Mohamed Ahmed
Recomend me a good course to learn c++ I'm a beginner
Eliezer
Mohamed Ahmed
ROfficer
Umm i am stuck at classes and objects, any advices? :(
Pavel
Umm i am stuck at classes and objects, any advices? :(
What parts of it you find not clear? You can think of classes as blueprints to build objects.
Ali mohammadi
Deleted account
Shourya
what's the best one?
Try Abdul bari .Ds and c++ on YT ..But would recommend to buy his courses on udemy..On sales sometimes they are very cheap ..Rs 350 apx..
Hmaada
hello i m using vscode for coding in c and i m trying to do an if and else if and else statement but by writing the else if(condition){} i have and error "expected statement" is there any sympatic one who can help me please ?
\Device\NUL
scanf may fail, so its return value needs to be checked. Otherwise you will have a potential reading uninitialized variable. Reading uninitialized variable is undefined behavior.
I think the only way to get input safely is get string and convert it into integer or float. scanf and std::cin are used to formating input. In Python and Rust, You can't get raw input.
Alviro Iskandar
I think the only way to get input safely is get string and convert it into integer or float. scanf and std::cin are used to formating input. In Python and Rust, You can't get raw input.
scanf can be safe if you use it right, people just don't care with the failure cases when working on it. Their mindset is not ready for real C programming. Do not ever trust any input from user. The program must not crash/UB/broken when receiving anything the user throws at it. That's why we must always validate them.
Alviro Iskandar
\Device\NUL
> Is using max field width useful ? what max field?
char str[101]; scanf("%100[^\n]", str); Maximal string input that str can receive is 100 chars.
Alviro Iskandar
char str[101]; scanf("%100[^\n]", str); Maximal string input that str can receive is 100 chars.
Yes, useful, it's to limit the buffer size, so any input can never overflow the program.
\Device\NUL
Yes, useful, it's to limit the buffer size, so any input can never overflow the program.
My question : Is people using max field width in real life application ?
Alviro Iskandar
My question : Is people using max field width in real life application ?
> Are people using [...] ? Some are, some aren't. But obviously they should be.
\Device\NUL
> Are people using [...] ? Some are, some aren't. But obviously they should be.
Btw, by checking value that scanf returned, is it same like std::cin.good()?
Alviro Iskandar
Btw, by checking value that scanf returned, is it same like std::cin.good()?
They have a different way of checking, but can serve the same purpose.
江流儿
Hey
江流儿
#include<iostream> using namespace std; int main() { int a = 3, n = 4; a %= n %= 4; cout << a << ' ' << n << endl; return 0; }
江流儿
Do you know what the problem here , no output
江流儿
The result is nothing Some notice says code is -107374.... I don't know why
Дмитрий
hi, could you tell me if it is possible to get sizeof(bool) if bool is stored in a variable as a string? string str = "bool"; cout << sizeof(bool);
Nomid Íkorni-Sciurus
klimi
isn't bool always 1 ?
i think it should be... i just don't understand the described problem with the string
Nomid Íkorni-Sciurus
yeah me neither
布丁
how is a bool stored in a string?