Captain
Am a beginner
Write a for loop which will add 5% of previous year fees to previous fees 🙂
Anonymous
Captain
Dima
no begging
Anonymous
Ariel
Aztec
Roxifλsz 🇱🇹
Anonymous
Aztec
Aztec
Aztec
Did you understand why?
Yes i understand how that worked.
I’m trying to understand how O(n) is related to the first error i was getting
Anonymous
Anonymous
Aztec
Anonymous
Jenny
is there a C# language?
𝓓𝓪𝓻𝓴 𝓟𝓱𝓮𝓸𝓷𝓲𝔁
Jenny
𝓓𝓪𝓻𝓴 𝓟𝓱𝓮𝓸𝓷𝓲𝔁
Jenny
Where what?
C# language, it seems like all codes are for C and C++
coal
coal
but probably you can ask for C# and someone will answer
Jenny
yes, actually
coal
!report
Anonymous
!report
Hey I'm sorry about that, don't get mad at me
Daniel
Hello guys, can someone tell me what i need learn tô understand this code?
Daniel
( ( void (*)( ) ) ValidateFns[0] )( );
Daniel
I know pointers and arrays
Daniel
But this is very confuse
coal
function pointers
Daniel
Will It call the function?
coal
coal
Daniel
Great! Thank you man!
Alviro Iskandar
But this is very confuse
Pay attention to the part that's marked by ^^^ below.
( ( void (*)( ) ) ValidateFns[0] )( );
^^^^^^^^^^^^^^^
This part is a cast to a function pointer that has unspecified number of arguments and returns void (or doesn't return any value).
( ( void (*)( ) ) ValidateFns[0] )( );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This whole part results in a function pointer, and the () after that means invoke the function, so you call that function.
For example:
void test()
{
printf("test");
}
int main(void)
{
void *arr[10];
// fill this with the address of a function
arr[0] = &test;
// cast to a function pointer and call it
((void (*)())arr[0])();
return 0;
}
The above code effectively calls test(). It's simply like:
void test()
{
printf("test");
}
int main(void)
{
test();
return 0;
}
coal
Daniel
coal
coal
for example, curl library needs you to specify a function pointer as the write_callback method of a response
coal
so it calls your custom function
coal
it's the C closest resemblance of C++ lambdas
coal
but not the same thing, as lambdas dont necessarily have names
Daniel
Nice tips! I will read more about this with those new knowledge
Daniel
Before I forget... sorry for my bad english! I am begin in C language and in english language too!
coal
coal
also, i recommend you to translate all sentences you write, to practice english
you write a sentence and check how the proper version looks like
Daniel
UrCodeBuddy️ 💻
Can someone plz explain to me how shell sorting work ?some notes or examples ...I tried it online but it's going over my head. Thanks in advance
Krishnaa
Anyone attempted last night's LeetCode's Weekly contest???? If not so, can u guys please look at the "Append K Integers With Minimal Sum".
Krishnaa
class Solution {
public:
long long minimalKSum(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
long int i=1; long long sum=0;
for(int j=0; j<nums.size(); j++){
if(k==0) break;
else if(i<nums[j]){
sum+=i; i++; k--; j--;
}
else if(i==nums[j]){
i++;
}
}
while(k--){
sum+=i; i++;
}
return sum;
}
};
Krishnaa
Please optimize the above code. It passed 77/107 test cases. and shows TLE.
Anonymous
🤗thanks for the welcome
Nomid Íkorni-Sciurus
How do you organize your CMake project?
I'll make my question more clear.
I have a build/ dir from conan and a src/ dir where the sources of the main executable are located.
I plan to have some sub projects, but this way I'll have to write all the dependent *.c files in the cmake file.
I'm not very fluent about cmake; is this the correct way?
Pavel
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
and adding them as static libraries for each folder
Prince Of Persia
Is there any ide lighter than vscode and handier than vim(even with extensions)?
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
not quite an "ide" but can become one very easily
Mr
Thanks a lot for it
-
Hello guys. Could you help me please
-
#include <stdio.h>
#include <string.h>
void main(){
char aaa[8];
printf("Write smth: ");
fgets(aaa,8,stdin);
int result = strlen(aaa);
printf("%d\n",result);
}
-
I entered Hello , it returns 6 instead of 5. I know it's because of fgets. Then I entered 12345678 and it returns 7 instead of 8
ʙʀʜᴏᴏᴍ ⑇
What is the difference between
int main
main
void main.
Anonymous
Hi
Anonymous
Bot
Shrivatsa
#include <stdio.h>
void main()
{
int a, b, c;
printf("enter a,b \n");
scanf("%d,", &a);
scanf("%d,", &b);
c = a + b;
printf(" the result is %d", c);
}
PS E:\c notes\1 c programs\clg assignment> gcc .\simply.c
PS E:\c notes\1 c programs\clg assignment> .\a.exe
enter a,b
5 5
the result is 698
#include <stdio.h>
void main()
{
int a, b, c;
printf("enter a,b \n");
scanf("%d,%d", &a, &b);
c = a + b;
printf(" the result is %d", c);
}
PS E:\c notes\1 c programs\clg assignment> gcc .\simply1.c
PS E:\c notes\1 c programs\clg assignment> .\a.exe
enter a,b
5 10
the result is 15
Shrivatsa
Hey anyone in the first program when I use scanf to take 2 values at once result is not coming properly, why is it so in second when I take scanf separately I am getting correct answer. Help out
klimi
#include <stdio.h>
void main()
{
int a, b, c;
printf("enter a,b \n");
scanf("%d,", &a);
scanf("%d,", &b);
c = a + b;
printf(" the result is %d", c);
}
PS E:\c notes\1 c programs\clg assignment> gcc .\simply.c
PS E:\c notes\1 c programs\clg assignment> .\a.exe
enter a,b
5 5
the result is 698
#include <stdio.h>
void main()
{
int a, b, c;
printf("enter a,b \n");
scanf("%d,%d", &a, &b);
c = a + b;
printf(" the result is %d", c);
}
PS E:\c notes\1 c programs\clg assignment> gcc .\simply1.c
PS E:\c notes\1 c programs\clg assignment> .\a.exe
enter a,b
5 10
the result is 15
$ ./a.out
enter a,b
5,4
the result is 9