I am sorting my array of car two ways. one by year which is shown below. and another one by make. Make is a char* How do I compare char pointers?
int i, j;
for(i=0; i<100; i++){
for(j=0; j<100-i; j++){
if(carArray[i]!=NULL && carArray[j]!= NULL && carArray[j+1]!=NULL){
if(carArray[i]->year > carArray[j+1]->year...
there is any way to run an infinite cycle that stops only on user input from keyboard
without asking every cycle to continue? in a C program
(I'm developing a C chat that read the entries with a for(;;) loop and I need to stop it only when the user want to type and send a message) hi all!
...
Hello everyone,
I have a program where user input is required, a user types in a number 1-8 to determine how to sort some data, but if the user just hits enter a different function is performed. I get the general idea of how to do this and I thought what I had would work just fine but I'm having some issues when it comes to when the us...
Hi,
I wans to read all of the memory associated with a particular process. I am aware of ReadProcessMemory, but as I have little experience of using it and I am fearful that I will just get a load of rubbish out (rubbish in...).
a) how do I work out, from the base pointer to the end) the total region that I can read
b) what is the bes...
The whole code is written in ANSI C, and it should remain so.
I have a callback defined like so:
typedef enum {
Event_One,
Event_Two,
Event_State
} EventEnum;
typedef void (*callback)(EventEnum event, void* data);
The callback recipient interprets data depending on the event value. This is the contract between the compone...
I have a function that returns an integer, between 1 and 255. Is there a way to turn this int into a character I can strcmp() to an existing string.
Basically, I need to create a string of letters (all ASCII values) from a PRNG. I've got everything working minus the int to char part. There's no Chr() function like in PHP.
...
What is stack unwinding? Searched through but couldn't find enlightening answer!
Thanks in advance.
...
I'm looking to "hide" some information in my code, and I'm not sure if this will do the trick or not. I know string literals are easily found and viewed in a compiled app, but what about integers? Lets say I define a number #define kHiddenNumber 1234567 and then in my code reference it using kHiddenNumber as an integer. Would that be vis...
When I write the following program:
file 1:
#include <stdio.h>
int global;
void print_global1() {
printf("%p\n", &global);
}
file 2:
#include <stdio.h>
char global;
void print_global2() {
printf("%p\n", &global);
}
file 3:
void print_global1();
void print_global2();
int main()
{
print_global1()...
Hi,
this was an interview question!
would the size of an integer depend upon the compiler or processor?
...
What are Async Sockets? How are they different from normal sockets (Blocking and Non-Blocking)?
Any pointers in that direction or any links to tutorials will be helpful.
Thanks.
...
This is a most singular problem, with many interdisciplinary ramifications.
It focuses on this piece of code (file name mainpp.c):
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int status;
if (fork())
{
FILE *f=fopen("/tmp/gcc-trace","a");
fprintf(f,"----------------------------------...
I want the data at pixel to be compared with the colour and then i want to find contour then take centroid points of the contour ,so i am using like this to find countourdata am i wrong at this statement
int pos = i * w * Channels + j; //channels is 3 as rgb
// if any data exists
if (data->imageData[pos]>0)
Code i...
I've been poking my nose in extending SAS string handling with some C functions such as a longest common substring algorithm. The proc FCMP functions get easily pretty inefficient.
The embedded C compiler in proc proto doesn't seem to produce the results I expect after writing the algorithm in Visual Studio. One thing I think I have ver...
I have a homework to build on paper a parameter marshaling protocol to be suited to call a method with one variable, or with an array (like a polymorphism).
procedure(var1)
procedure(array1)
How would you define the protocol? How about the method in C++
...
I am developing a 64 bit application. Is it possible to run the 64 bit application on a 32 bit OS?
Please note that the question is generic and not specific to Windows OS. Infact the application in itself is portable across OS.
...
Possible Duplicate:
Is global variable in a shared library / dll, shared across process
Hi stackoverflow,
I have just a little question about using .so in C programming.
I want to use static and global variables in a shared library.
If this library is loaded and used by several processes, will these processes share the global ...
Can anyone provide an example of a function that returns the cross product of TWO 2d vectors? I am trying to implement this algorithm.
C code would be great. Thanks.
EDIT: found another way todo it that works for 2D and is dead easy.
bool tri2d::inTriangle(vec2d pt) {
float AB = (pt.y-p1.y)*(p2.x-p1.x) - (pt.x-p1.x)*(p2.y-p1.y);...
Hi,
I'm trying to build my own Hash Table in C from scratch as an exercise and I'm doing one little step at a time. But I'm having a little issue...
I'm declaring the Hash Table structure as pointer so I can initialize it with the size I want and increase it's size whenever the load factor is high.
The problem is that I'm creating a t...
Hello,
I'm trying to write a server program in C,
using another client, I get this error when I try to connect through port 2080 for example.
connection refused
What can be the reasons of this error?
...