Hsn
Shouldn't the "text stuff %d" should be %s?
sorry i truncated code of snprintf .. char *pcWriteBuffer = pDebugInfo_getMessageBuffer(); UBaseType_t uxArraySize; //unsigned long type <<< uxArraySize = uxTaskGetNumberOfTasks(); sprintf(pcWriteBuffer, "tasks %d", uxArraySize);
Hsn
the issue is "stack overflow" inside the sprintf
Hsn
it was sn replaced to sprintf ..
Hsn
this is embedded application .. ^ and there is function that checks stack over flow .. im failing in this function ^ snprintf
Talula
the issue is "stack overflow" inside the sprintf
But when you use %d it means you want a number, I think you don't want that you want string.
Hsn
although i dont think it takes lots of stack variables
Hsn
But when you use %d it means you want a number, I think you don't want that you want string.
uxArraySize is unsigned long sprintf(pcWriteBuffer, "tasks %d", uxArraySize);
Talula
sprintf will copy the information from tasks %d, where uxArraySize would be a number... to pcWriteBuffer. if it's uxArraySize, I don't know what microcontroller you're using but normally embedded C uses %ld for long.
Hsn
its getting stuck inside FreeRTOS stack overflow hook
Hsn
i increased the stack size of the task that calls this function but it didnt help
Hsn
hmm i thought %d is long
Talula
This is why I said, I don't know what compiler, microcontroller you're using...
Talula
hmm i thought %d is long
https://stackoverflow.com/questions/38561/what-is-the-argument-for-printf-that-formats-a-long
Hsn
its arm m0 gcc . i see its an int .. i think it should be unsinged long
Hsn
i think thats not the source of the issue though ... going to increase the stack more .. stack is getting full and im getting cheap on bytes
Talula
its arm m0 gcc . i see its an int .. i think it should be unsinged long
So RP2040? How much stack have you allocated for it, now?
Hsn
no its samd21j18
Hsn
i increased 40 bytes lo
Talula
i increased 40 bytes lo
Increase it more even unless you're short on RAM... if you are not short on Memory it doesn't matter... but normally compiler wouldn't complain about stack overflow issues in C... Your microcontroller would crash... but I haven't used SAMD with RTOS.
pyMorgado
You have not selected the right project to execute when you click run... On the right side, right click on the project you want to run and click "set as Startup Project".
if I have selected it correctly, the debugger does its job and generates the executable .exe, but I always get this message
wilson
Hello, How can i add the .so and headers libraries to my project? i'm using cmakelist.txt i have this error message: undefined reference to.... I already added all the paths and I still getting this error, help me please
wilson
what i'm doing wrong? include_directories(src) link_directories(src/the-library/v6.6.1_P1_20210406_api_tradeapi_se_linux64) add_executable(poc_c_ctp src/CustomMdSpi.cpp src/CustomMdSpi.h src/main.cpp) target_link_libraries(poc_c_ctp src/the-library/v6.6.1_P1_20210406_api_tradeapi_se_linux64/ThostFtdcMdApi.h) I got this error: /usr/bin/ld: cannot find -lsrc/the-library/v6.6.1_P1_20210406_api_tradeapi_se_linux64/ThostFtdcMdApi.h collect2: error: ld returned 1 exit status
Anonymous
#include<stdio.h> Main() { Printf("hello world! ") }
Anonymous
I am new at programming i think i will get support here!
Anonymous
Why?
Hitesh
Has anyone used Lief library in C++ ?
Stefano
can someone tell me how I can I use fork n times in C? i tried with a for loop but i get too many processes
olli
can someone tell me how I can I use fork n times in C? i tried with a for loop but i get too many processes
Every call to fork creates a new process. Which problem are you trying to solve?
Stefano
Every call to fork creates a new process. Which problem are you trying to solve?
for(i=0; i<m; i++){ usleep(100000); pid = fork(); if (pid == 0){ i = m; } } if(pid == 0){ Nemico(pipeout, MAXY); refresh(); usleep(DELAY); } Do you think this may be a correct solution?
Stefano
Nemico() is the function I want to fork n times
Anonymous
#include <stdio.h> int main() { int var; var = 10; int *p = &var; int y = 1; p = &y; printf( "%p\n", p ); printf( "%p\n", (void *) p ); return 0; } What is the difference between printing directly p and with (void*) as prefix to p ?
Anonymous
Like may I please know what's the use with and without it ?
Anonymous
Why values changes when I replace %p to %d ?
Null
.
klimi
Why values changes when I replace %p to %d ?
because they mean different things
Anonymous
because they mean different things
Like hex and integer values ?
klimi
pointer address and integer
Anonymous
pointer address and integer
Regarding use of (void*)
Anonymous
Consider two arrays. A={5,2,6,3,1} B={21,22,23,24,25} Assume quick sort is applied to sort above arrays in descending order. Let the time taken to sort array A is T1 and the same for array B is T2. Which of the following conditions holds true?Immersive Reader (1 Point) T1>T2 T1=T2=5 T1<T2 T1=T2
Anonymous
ANYONE KNOWS THIS?
klimi
ANYONE KNOWS THIS?
IS THAT SOME SORT OF HOMEWORK OR ASSIGMENT?
Anonymous
NO NO
klimi
WHY IS THERE A "1 Point" THEN?
Anonymous
WHY IS THERE A "1 Point" THEN?
I AM PRACTCING SOME QUESTIONS FOR INTERVIEW
klimi
I AM PRACTCING SOME QUESTIONS FOR INTERVIEW
OKAY THEN, WHAT DO YOU THINK THE CORRECT ANSWER WOULD BE? PROVIDE YOUR OPINIONS
Anonymous
THE CORRECT ANSWWER SHOULD BE T1<T2
morningstar
hello everyone, I have a question regarding the getchar() function so I was trying to solve this problem from chapter 6, programming exercise 2 of "C Programming: A Modern Approach". Everything works fine, but there is no prompt when 'i' becomes 24 and only prints the printf function when 'i' becomes 24. Consequently, I wasn't able to do it anymore so I tried to find solutions on the internet and I found the reason why: #include <stdio.h> int main(void) { // Modify square2.c program of Section 6.3 so that it pauses every 24 squares // and display the following message int i, n; printf("Enter number of squares: "); scanf("%d", &n); getchar() == ' '; for (i = 1; i <= n; i++) { printf("%10d %10d \n", i, i * i); if (i % 24 == 0) { printf("Press Enter to continue... \n"); getchar(); } } return 0; This is my code and the only thing I added is the "getchar() == ' '" and suddenly, it works. I am happy it works, but I am more depressed asking why "getchar() == ' '" is necessary to add. For some reason, if I try to remove it, there will be no prompt when 'i' becomes 24 and only subsequently prompt later on in the program when 'i' again became the 24th square.
morningstar
sorry if the message was long, I was typing this on Notepad, and I didn't realize there were a lot of unnecessary white-spaces...
morningstar
yes, that is the reason why I am so confused
morningstar
if I try to remove it, there will be no prompt when 'i' becomes 24
\Device\NUL
yes, that is the reason why I am so confused
No reason to do that, just getchar(), not getchar() == ' '
Jasur Fozilov 🐳
What project can you recommend from github to learn more about C ++ throughout the project?
Jasur Fozilov 🐳
coal
Making a 3D Simulator for Rocket launching.
i second this but without the simulation
coal
just the math, using a graphics library is hell
coal
Can I find from github it ?
there must be some maybe
✨Justina
#include <iostream> using namespace std; int findsSmallest(int[],int); int main () { const int MAX_SIZE = 50; int size; int arrInt[MAX_SIZE]; int smallest; cout<<"You may enter up to 50 integers"<<endl; cout<<"How many integers would you like to enter?"; cin>>size; for (int i = 0; i <size; i++) { cout<< "Enter your Number" << i+1<<":"; cin>>arrInt[i]; } smallest = findSmallest(arrInt,size); cout<<"The smallest value is :"<<smallest; return 0; } int findSmallest(int arr[], int size) { int smallestInt = arr[0]; for (int j = 1; j<size; j++) { if(arr[j] < smallestInt) smallestInt = arr[j]; } return smallestInt; }
✨Justina
whats the problem at this coding?
Roshan
Okay so wht I need to change now?
Change the name in funcn declaration
Anonymous
Hello
Anonymous
I am a 12 std student
Anonymous
Can anyone let me know how can i improve my coding Skills?
Anonymous
What should I do
RupesH
How can I improve my coading skills?
RupesH
And hello I am 1st year bca Student.
Anonymous
practice
Okay. But from which sources
Anonymous
On youTube it's bit confusing what to watch and whoes
RupesH
I have to preparation from zero level