I was solving a puzzle, where im required to find the largest Prime Factor of a composite number entered by the user.
I thought of something and have tried it out, but it doesn't manage to detect the largest prime factor amongst the factors of the composite number.
I'm appending my code below, I'd be grateful if anyone could help me out...
The title says it all. How does a C program get started?
...
Hi,
static int
write_stream(const void *buffer, size_t size, void *app_key)
{
char *stream = (char *)app_key;
return 0;
}
what am I doing wrong here? Why pointer casting does
not result in a copying of (size_t size) bytes from buffer into the
stream defined by app_key?
Thanks
am calling this function as argument of anot...
i want create a header file in C-programming and add it to library to use. Please could you help me.
...
Possible Duplicate:
confusion in scanf() with & operator
Why we need a & in scanf for inputting integer and why not for characters.
Do the & in scanf refers to merory location while getting input.
Eg:-
main()
{
int a;
char c;
scanf("%d",&a);
scanf("%c"c);
}
...
Hi,
I have understood why memory should be aligned to 4 byte and 8 byte based on data width of the bus. But following statement confuses me
"IoDrive requires that all I/O performed on a device using O_DIRECT must be 512-byte
alligned and a multiple of 512 bytes in size."
What is the need for aligning address to 512 bytes.
...
Hi, just wanted to know how to call php script from running C code on Linux and pass a couple of parameters.
Thanks
...
I am new to using the PARI C library.
How can I perform bitwise ('and' or 'or') operations on the GEN type variables?
...
I am accepting a composite number as an input. I want to print all its factors and also the largest prime factor of that number. I have written the following code. It is working perfectly ok till the number 51. But if any number greater than 51 is inputted, wrong output is shown. how can I correct my code?
#include<stdio.h>
void main()
...
I have a number of private frameworks I want to use, however I cannot find any headers for them. Is there a de-facto way of getting arguments from C function calls using IDA Pro? (Not ObjC messages).
Edit: Oops, I meant C not C++.
...
Hello,
I have a sparse matrix that is not symmetric I.E. the sparsity is somewhat random, and I can't count on all the values being a set distance away from the diagonal.
However, it is still sparse, and I want to reduce the storage requirement on the matrix. Therefore, I am trying to figure out how to store each row starting at the f...
we have one of Cirque touchpads.
http://www.cirque.com/downloads/docs/tsm9925.pdf
now we want to read absolute position of tap from this touchpad using c\c++ application. unfortunately company developed only windows drivers but we need to read positions in the linux. we tried to use /dev/input/eventN subsystem but received only directi...
I am accepting a string as a command line argument. I want to check whether the inputted string is a palindrome or not and print the result. I have written the following code. But its displaying the result 'not palindrome' for all inputs.
#include<stdio.h>
#include<string.h>
int main(int argc, char argv[20]) {
int i;
int l = st...
I'm expanding from perl to C and I'm trying to use curl's library to simply save a file from a remote url but I'm having a hard time finding a good example to work from.
Also, I'm not sure if I should be using curl_easy_recv or curl_easy_perform
...
If I understand correctly, then foo1() fails to unlock &private_value_. As a result, foo2()'s thread_mutex_lock does not work since foo1() never released it.
What are the other consequences?
int main ( ... )
foo1();
foo2();
return 0;
}
foo1()
{
pthread_mutex_lock(&private_value_);
do something
// no unlock!
}
foo2()
{
pthread_...
Hello,
I have a UNICODE_STRING that I would like to compare to a null-terminated ANSI string to check if they are the same. I'm using C. I would like to avoid including winternl.h for RtlInitUnicodeString.
What is the preferred method doing this?
Or, alternatively, is there any problem with me using MultiByteToWideChar() to conve...
I want to declare a bitfield with the size specified using the a colon (I can't remember what the syntax is called). I want to write this:
void myFunction()
{
unsigned int thing : 12;
...
}
But GCC says it's a syntax error (it thinks I'm trying to write a nested function). I have no problem doing this though:
struct thingStru...
A rat is placed in a maze at some unknown position in the maze.
All we can go is in up, down, right or left directions. And we have two methods:
tryMove(<direction>) which returns false if there is a wall and true if we can move.
bool hasLadder(): which returns true if there is a ladder to escape.
We have to write a function explo...
I have this code:
void PrintMainParameters(int n, char* array[])
{
int i = 0;
for(i = 0; i < n; i++)
{
printf("%s \n", array[i]);
}
}
int main(int argc, char* argv[] )
{
PrintMainParameters(argc, argv);
}
Works fine. Now I want to write PrintMainParameters as prototype to declare the function later in the source file.
I...
How to declare a variable of bool datatype in C running on Linux platform. I tried the following but its giving an error:
#include<stdio.h>
#include<string.h>
bool factors[1000]
void main()
{
}
...