I know that this will not work, but hopefully you can see what I'm trying to do
#if ASSIGN_ALLOWED
#define MAYBE_SKIP_REST_OF_LINE
#else
#define MAYBE_SKIP_REST_OF_LINE ; //
#endif
char str[80] MAYBE_SKIP_REST_OF_LINE = "Hello\n";
long array[3] MAYBE_SKIP_REST_OF_LINE = { 7,8,9 };
int x MAYBE_SKIP_REST_OF_LINE = 3;
//...
void main()
{
char str[2][7] = {"1234567", "abcdefg"};
char** p = str;
printf("%d\n", *(p+1));
printf("%c\n", *(p+1));
}
The output is:
1631008309
5
Edit: Thank you. I see the '5' is only 0x35, other than str[0][4] I supposed to be. Why can't I get out str[0][4] instead of this strange 1631008309??
OMG, I'm foolish...
i am looking into making a C program which is divided into a Core and Extensions. These extensions should allow the program to be extended by adding new functions. so far i have found c-pluff a plugin framework which claims to do the same. if anybody has any other ideas or reference i can check out please let me know.
...
I'm looking at implementing a fuzzy logic controller based on either PyFuzzy (Python) or FFLL (C++) libraries.
I'd prefer to work with python but am unsure if the performance will be acceptable in the embedded environment it will work in (either ARM or embedded x86 proc both ~64Mbs of RAM).
The main concern is that response times are ...
I am embedding ruby (1.9.1) as a scripting language in my window manager project (subtle). Since the switch from
1.8 to 1.9 I am facing many problems with asynchronous signals in multithreading.
How is signal handling supposed to work and does the thread that ruby creates automatically have any own
signal handlers? Due the asynchronous ...
How would I generate automatic bindings for a C project that is built using CMake?
I want to generate bindings for Python, Java, .NET, PHP, Perl, TCL, Ruby and Octave automatically.
...
Hi,
I am using DllImport to call method in c wrapper library from my own .net class. This method in c dll creates a string variable and returns the pointer of the string.
Something like this;
_declspec(dllexport) int ReturnString()
{
char* retval = (char *) malloc(125);
strcat(retval, "SOMETEXT");
strcat(retval, "SOMETEXT MORE");
...
My program prints out HUGE numbers - like 100363443, up to a trillion -- and it sort of hard to read them, so I would like to print any number in easy to read form.
right now I use
printf ("%10ld", number);
format
I would appreciate a resulting number using printf. Most of my code is c++ yet I don't want to introduce std::cout, as...
Okay, so i am currently attempting to debug a problem on a win2003 server. Basically we have an ancient program that calls C's system() function. Now i basically tracked it down to the fact that when the system() runs the application. The application only has access to around ~500 or so megabytes of memory. Yet if i run the application m...
I only have access to 'C' and need to replace characters within a character array. I have not come up with any clean solutions for this relatively simple procedure.
I am passed a character array, for example:
char strBuffer[] = "/html/scorm12/course/course_index.jsp?user_id=100000232&course_id=100000879&course_prefix=ACQ&v...
Hello. I'm writing some C code for an embedded application, and I've run into a problem wherein a compare against an enumerated value is not being executed correctly. Take the following code snippet, for example:
typedef unsigned int UINT16;
typedef enum enum_items_tag
{
ITEM_1,
ITEM_2,
ITEM_3,
/* ... */
ITEM_918,
...
My Shell should understand PATH environment variable. It can be set and modified. It runs in two ways -interactive & batch mode. Shell is capable of taking more than one job like ls;ps;wc file;cal.
I know I will have to use execs, forks and pipes but just cant get started.
Thank you in advance.
Edited:
PS:Not a homework question. Newb...
How can I get a libtiff TIFF object from a MagickWand object (in C)?
I want to open any given image type with ImageMagick and run tesseract on it. Tesseract seems to use libtiff for it's IO, ImageMagick seems to use libtiff for it's tiff handling, so I figured I should somehow be able to use ImageMagick with tesseract without meddling i...
Obviously this is just a fraction of the code.
printf("Please enter a positive number that has a fractional part with three or more decimal places\n");
scanf("%5.2d", &x);
printf("The number you have entered is %5.2d\n" ,x);
Would this automatically round the number I type in? Or is there another way to do this?
Edit:
printf("Please...
Hi:
I'm doing some Linux kernel development, and I'm trying to use Netbeans. Despite declared support for Make-based C projects, I cannot create a fully functional Netbeans project. This is despite compiling having Netbeans analyze a kernel binary that was compiled with full debugging information. Problems include:
files are wrongl...
I'm trying to write a function to swap 2 elements in a 2D array:
void swap(int surface[][], int x1, int y1, int x2, int y2) {
int temp = surface[x1][y1];
surface[x1][y1] = surface[x2][y2];
surface[x2][y2] = temp;
}
however when I try to compile it (gcc), I get this error message:
Sim_Annealing.c: In function `swap':
Sim_...
I'm using MagickCore to generate images from scratch. I'm trying to save my Image as a PNG file, but whenever I call WriteImage, it outputs to standard out rather than to the filename that I specified. For example:
Image *image = ImageGenerator(...); // generates valid image
ImageInfo *info = CloneImageInfo (NULL);
info->file = NULL;
s...
I'm trying to write a program that counts the number of perfect numbers within a limit, but the compiler keeps on giving me the "missing ')' before identifier 'num_squares'" error. Please help...
int main(void) {
int num_squares = 0;
int limit = 30;
while(num_squares * num_squares < limit)
num_squares++;
printf("%d," num_squares)...
What I'm trying to do is take this C code and optimize it using a technique called loop unrolling, but in this case I want to use four-way loop unrolling. Now, I understand the technique and I understand the concept I just don't know how to apply it to this code. Do I have to add in some extra variables? Do I have to have some code afte...
I have a program written in C and it calls gets() from a switch when a user chooses the option of 3. Here is my code. It does not seem to wait to wait for the user to input something. Rather the program continues in the switch.
void getField();
#include <stdio.h>
#include <string.h>
/*#include "stubs.c"
#include "record.h" */
int debu...