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
Talula
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
Hsn
although i dont think it takes lots of stack variables
Hsn
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
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
labyrinth
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
Anonymous
Why?
olli
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
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 ?
\Device\NUL
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
Anonymous
klimi
pointer address and integer
Anonymous
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?
Anonymous
NO NO
klimi
WHY IS THERE A "1 Point" THEN?
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...
\Device\NUL
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.
You just returning 0 or 1
getchar() == ' ' Do nothing, It just eating one character (Maybe newline or EOF) after scanf
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
Jasur Fozilov 🐳
What project can you recommend from github to learn more about C ++ throughout the project?
Talula
Jasur Fozilov 🐳
coal
coal
just the math, using a graphics library is hell
coal
✨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
✨Justina
✨Justina
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
RupesH
How can I improve my coading skills?
RupesH
And hello
I am 1st year bca Student.
ranz
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