Tagged Questions
-2
votes
2answers
47 views
Showing error in function pointer code [closed]
I have written a code that uses function pointers to compare strings. But, it is showing me errors and I don't know how to correct them. Here is the code:
#include<stdio.h>
...
-7
votes
0answers
38 views
please help i would like to know whats wrong with this program,please ASAP [closed]
hey so in my code there's an array,in this array third of the numbers in it are divided by 3 without a remainder,the other third are numbers that have the remainder oof when divided by 3 and the last ...
1
vote
5answers
56 views
Why should or shouldn't we prefer a macro that accepts arguments over a function that does the same job?
Following are two programs that give the area of the circle when the radius is passed as argument.But in the first program, macro.c, I am using a macro for the job ,while in the second,function.c I am ...
-1
votes
0answers
87 views
if/else statement returning incorrectly
I'm having real difficulty attempting to get an if/else statement to return true. Towards the end of the code there is an interrupt service routine. Within it there are 3 if statements related to the ...
1
vote
3answers
65 views
Returning void from a double function?
I have a function which is a double and normally returns the new value for a variable, but sometimes I don't want to change the variable and I would like to signal that by returning a special value, ...
1
vote
0answers
51 views
Programming a Z-Domain Function in C
I'm trying to create a simple PID simulator in C. It is a simple cruise control system and I have chosen to model my system as a low pas filter.
I'm having difficulty writing my mathematical model in ...
0
votes
2answers
50 views
Function removes extra spaces but leaves one space between words in a char pointer
I need a function that will take a char pointer like char *s = "abc def gf ijklmn". If it is passed through the function int space_remove(char *) it should return the number of extra spaces and ...
-1
votes
0answers
32 views
passing char* argument to function in C
I have the following function:
void func(unsigned char* src,unsigned char* dest){
//do something with dest, using src
for(i=0;i<10;i++){
//print some dest values
}
}
I call this ...
0
votes
1answer
32 views
Clarification on concept of callbacks and function pointers in c
I found this line on wikipedia about function callbacks,
"In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other ...
0
votes
2answers
109 views
Measuration By Division [closed]
The function is y=x^2+2x+1 and the domain is from 0 to 10. If you enter the number of intervals, your program prints the result. Complete the function, MeasurationByDivision().
I made below C code, ...
0
votes
1answer
46 views
For a function pointer func_ptr,(*func_ptr)() invokes the function.But why are (****func_ptr)() or (***func_ptr)() valid?
Suppose func_ptr is a function pointer to the function test().Then we know that can invoke the function test() using this pointer as
(*func_ptr)();
But I was told today that even ...
0
votes
3answers
38 views
Changing stdout (putch() function) on the fly in C
I'm using the XC8 compiler. For that, you have to define your own void putch(char data) function in order for functions like printf() to work, as is described here. Basically, putch() is the function ...
0
votes
3answers
37 views
What do we have in the bytes beginning at the “Address of a function”?How to know how many bytes to consider?
My brain gets numb just even imagining this.So bear with me if my question is little wordy.So I've sliced my question into parts.
1) What do we have at the at the bits/bytes starting at the address ...
0
votes
1answer
55 views
How can I get this C program to call this function without modifying the code?
I was wondering if it was possible to get ret to be called without modifying the code. Thanks for looking!
#undef _FORTIFY_SOURCE
#include <stdio.h>
#include <stdlib.h>
...
2
votes
3answers
69 views
Filling the arrays with different data type by 1 function
I have to fill the 2 arrays of int and double using function.
So, i make 2 almost the same functions, which differ only by data type.
void fill_double(double* arr,int n)
{ ...