Anonymous
Clrscr() doesnt work anymore use system("cls") instead it is in windows.h headerfile
novice
error: invalid operands to binary expression ('float' and 'int') if (grid%2 == 0) ~~~~^~ 1 error generated.
novice
this is what compiler saying
novice
why 0.0f ? pls explain me
novice
let me try first
novice
its showing same error
novice
ok
novice
no change
Anonymous
no change
Make grid int instead of float
novice
float
Anonymous
Modulas works with integers
novice
Modulas works with integers
ya now it's running perfectly but if i want grid to be float then what will i do?
novice
oh , wait
novice
no bro it's showing same error
novice
i tried it bro
Anonymous
Anonymous
Modulas % returns remainder which is always an int not floating point number
novice
ya now it's running perfectly but if i want grid to be float then what will i do?
there is one way , i can use typecast if i don't want to change it from float
novice
(int)grind%2
Anonymous
U can but its easier to just use int.i mean its just a grid , it doesnt have a lot of activities going on. But u can do it 4 practice
Anonymous
#include<stdio.h> void main(){ int list[5][5]; int i,j,x,y,max=0; for(i=0;i<5;i++){ for(j=0;j<5;j++){ printf("Enter element:"); scanf("%d",&list[i][j]); if(list[i][j]>max){ max=list[i][j]; x=i; y=j; } } } printf("Max:%d \nlocation:[%d][%d]",max,x,y); }
Mr.
Hello folks, I'm with the fallowing error using clang++ compiler, but in the g++ this doesn't happen: #include <iostream> void arr(char* C) { while (*C != '\0') { printf("%d-", &C); printf("%c", *C); C++; } printf("\n"); } int main() { char C[20] = "Hello"; arr(C); }
Mr.
This is my algorithm, and the error that occurs using clang is: clang++ .\pointers.cpp .\pointers.cpp:7:19: warning: format specifies type 'int' but the argument has type 'char **' [-Wformat] printf("%d-", &C); ~~ ^~
Mr.
Any suggestion about why this occurs?
Mr.
*In g++ compiler the program works fine*
Ludovic 'Archivist'
This is my algorithm, and the error that occurs using clang is: clang++ .\pointers.cpp .\pointers.cpp:7:19: warning: format specifies type 'int' but the argument has type 'char **' [-Wformat] printf("%d-", &C); ~~ ^~
Yes, it is saying that printing a char** as int and warning you. This is not an error. You may want to cast the pointer to state your intent in printing the address of the cstring rather than something else (ans adding a comment for the same purpose)
Mr.
Yes, it is saying that printing a char** as int and warning you. This is not an error. You may want to cast the pointer to state your intent in printing the address of the cstring rather than something else (ans adding a comment for the same purpose)
Hmmm, okey. I was reading about this type of warning (-Wformat), but I don't find anything about how to ignore that as the g++ do. Now I did a test, I delete the compiled file resulted of g++ and tryed again, but with clang... the .exe was created without any problem, so it is just a warning as you say. Anyway thanks bro.
Mr.
Yap, that's works. But now I realize that sometimes is important to do not avoid this warnings. Tks for the tips
Subhash Suthar
brother can i get study material on c language
Go D.
Gcc not recognised
Mr.
Gcc not recognised
What the messege alerts? Appear something when you type gcc —version on cmd?
Go D.
Wait a min. I start my pc
Go D.
Cmd says all rights reserved
Go D.
Vs code says the term gcc is not recognised as the name of a cmdlet, function or operable program
Go D.
And #include<stdion.h> it is error
Mr.
Hmm okey, so in this situation you need to configure your WORKSPACE, to do the vscode recognize the compiler path and libraries.
Mr.
I recommend that you download the extentions of c/c++ in vscode
Go D.
I did
Mr.
Press ctrl+shift+p in the tab of your project, after this, select the C/C++ Edit Settings (JSON) and put the right configs to your compiler path and libraries
Mr.
You can find more about workspace configuration here: https://code.visualstudio.com/docs/getstarted/settings But I think that following what I say probably will resolve your problem
Go D.
Thank you
Ludovic 'Archivist'
Vs code says the term gcc is not recognised as the name of a cmdlet, function or operable program
You are running with power shell as a command line. You need to do & gcc --version Instead
Ludovic 'Archivist'
The & means you intent to run a program and not a Powershell command
Go D.
Lemme try
Go D.
I think i could not install compiler correctly
Ludovic 'Archivist'
I think i could not install compiler correctly
You may have installed it, but your system may not be configured properly to *find* it
Ludovic 'Archivist'
I think i could not install compiler correctly
Find the folder where the toolchain is installed and look for a folder named "bin", copy the full path of this folder, and add it to your "PATH" environment variable (Google it, it is not very hard)
Prinzkyd
hey Anyone with an idea of how to reverse an array?
Anonymous
hey Anyone with an idea of how to reverse an array?
Use two pointers one at 0 and one at end and swap them.
Kaashᅠ
Use two pointers one at 0 and one at end and swap them.
also, making a duplicate array and initializing the first array with the reverse indexes of second duplicate array.
Unknown man
also, making a duplicate array and initializing the first array with the reverse indexes of second duplicate array.
Can we also use pointer arithmatic on a pointer variable having address of last element and we will subtract 1 number and we will get number before
Unknown man
Can someone help me with hcf program i get confuse with it
Unknown man
I am confusing in logic if we take 5 and 10 what will be hcf
Dark_🗿_
Hi guys
Dark_🗿_
I'm new to this field
Dark_🗿_
I needed to know abt some basics abt this lang tht could help me Can u please help me out 🙏🙏
Amaregouda
static variables are initialises at only once means!??
Amaregouda
please explain this
Rifa
static variables are initialises at only once means!??
It mean You cant initialize again, u just can change the value
Amaregouda
u mean i canot assign new value to static variables??
Rifa
Initialized is assignment a value when variable declaring
Rifa
English is hard v:
Anonymous
no
Amaregouda
i am confised please help
Rifa
Just share the code
Amaregouda
MODIFIED QUESTION i declared a static variable inside a function with value 0, then added 1 to variable as count+=1. then print this function in main function twice. it produces the value 1 at first call, second call produce 2. then i reinitialise the variable with value 10 and print. its output is 10.
Amaregouda
i am not permitted to share media in this group