I read that \n consists of CR & LF. Each has their own ASCII codes.
So is the \n in C represented by a single character or is it multi-character?
Edit: Kindly specify your answer, rather than simply saying "yes, it is" or "no, it isn't"
...
My problem is very simple, but I really don't know how to manipulate strings in C
The problem is:
I have a struct called person
struct person
{
char name[25] // use char *name better?
}p;
I also have a function called p *addNewPerson(char *name)
p *addNewPerson(char *name)
{
p *newPerson = (p *)malloc(sizeof(person));
//here h...
Whats the most efficient way to search for a sub string in SQLite?
I'm looking at the LIKE operator.
Do I have the right idea? Has this worked well for you?
http://www.sqlite.org/lang_expr.html
Thank You.
...
Is the following syntax to define an array valid syntax in C?
#define array[] { \
for (j=0; j<N_frequencysteps;j++) \
{ \
array[j] = (function); \
} \
}
If not, how do I define an array in C?
...
Possible Duplicate:
Why are C character literals ints instead of chars?
Why when using C does sizeof('x') return 4 but sizeof('x') in C++ returns 1?
C++ normally strives to be nothing more than a superset of C so why do the two results diverge?
Edit
Just some further clarification. This seems like a deliberate move on the p...
In C++ C: Output: "1610612736"
#include <math.h>
#include <stdio.h>
int main(int argc, char** argv)
{
printf("%d\n", fmodf(5.6f, 6.4f));
getchar();
}
In C#: Output: "5.6"
using System;
static class Program
{
public static void Main(string[] args)
{
Console.WriteLine(5.6f % 6.4f);
Console.Read();
...
I'm trying to make embed Evince (libevview-2.30) in a Python and a C program, but it doesn't work. I'm using Ubuntu Lucid. Here is my C code:
#include <gtk/gtk.h>
#include <evince/2.30/evince-view.h>
#include <evince/2.30/evince-document.h>
int main(int argc, char *argv[]){
GtkWidget *window;
EvDocument *document;
EvDocumen...
Hey there!
I've been doing PHP for a long time now and I'd like to make some desktop applications on my Mac. I've never used C before but I installed xcode and I could do some basic things with some terminal apps.
I'd like to make an application with a GUI. I don't know how to add libraries or frameworks in xcode though and I don't kno...
Here is what I'm trying to do. I'm trying to make a bullet out of the center of the screen. I have an x and y rotation angle. The problem is the Y (which is modified by rotation on the x) is really not working as intended. Here is what I have.
float yrotrad, xrotrad;
yrotrad = (Camera.roty / 180.0f * 3.141592654f);
xrotrad = (...
PeekNamedPipe(
tmp_pipe, // __in HANDLE hNamedPipe,
NULL, // __out_opt LPVOID lpBuffer,
0, // __in DWORD nBufferSize,
NULL, // __out_opt LPDWORD lpBytesRead,
&totalBytesAvailable, // __out_opt LPDWORD lpTotalBytesAvail,
NU...
What's the best method to print out time in C in the format 2009‐08‐10
18:17:54.811?
Atm, I have Thu Sep 9 11:10:08 2010 but can't figure out the above.
...
New to StackOverflow and new to C. I'm trying to take a struct as a parameter in a function 'add_fields', which adds the first two int fields 'a' and 'b' and puts the result in int field 'c'. Not getting anything from the compiler, so obviously I'm doing something wrong. I just don't know what. Any help would be appreciated.
#inclu...
typedef struct pilha Pilha;
struct pilha
{
char metodo[31];
Pilha *next;
};
void create_empty_stack(Pilha *Stack)
{
Stack->next = NULL;
}
int main()
{
Pilha *Stack;
create_empty_stack(Stack);
}
Gives me an execution error.
What's the problem with this function?
...
Ideally, what I'd like to be able to do is take the name of a time zone and call a function to ask for its corresponding time zone info (offset from UTC, DST offset, dates for DST switch, etc.) in Linux. However, I can't find any way to do this. The information exists in /usr/share/zoneinfo/ in the various binary files there, but I don't...
I've been working on a polling TCP daemon for some time now. Recently, I've read that non-blocking sockets can sometimes throw an EWOULDBLOCK error during a send() or recv(). My understanding is that if recv() throws an EWOULDBLOCK, this (usually) means that there's nothing to receive. But what I'm unclear on is under what circumstances ...
Hi,
consider the following code:
#define MAX_COUNT 4
static int foo(int w[MAX_COUNT])
{
int *p = w;
if (w) {
w[0] = 10; w[1] = 20; w[2] = 30; w[3] = 40;
}
return 0;
}
is it portable and legal pass NULL to above defined foo() (for example, for a situation when I don't need w[] be altered)? Given that the name...
In the following code.A mutex is initialized.what is the significance of NULL.
pthread_mutex_init(&a->monitor,NULL);
I want to know why we pass NULL as the second parameter.
...
I have created a function for a thread, but I want to pass multiple parameters to the function.
Here's my source code :
#include "work.h"
#include <stdio.h>
#include <unistd.h>
#include <pthread.h> // compile with -lpthread
int count = 20;
void* ChildProc(void* arg)
{
int i;
for(i = 1; i <= count; i++)
{
pr...
typedef int (fc_name) (void);
here fc_name is any valid C symbol.
how different is this from a function pointer typedef ?
...
func()
{
fun1();
fun2();
fun3();
fun4();
fun5();
fun6();
..
..
..
..
fun99();
fun100();
}
by using function pointers in C program? I need to call this program repeatedly in my program.
...