[Solved] Recursive function to reverse find [closed]

[ad_1] Here’s a pretty straight forward recursive implementation. Sadly, it’s not tail recursive though. Full Implementation: char *rfind(char* str, char ch) { if (*str == ‘\0’) return NULL; char * pos = rfind(str + 1, ch); if (pos != NULL) return pos; if (*str == ch) return str; return NULL; } Base Case: str is … Read more

[Solved] why get I segmentation fault (core dumped) on compiling my code C (linux) [closed]

[ad_1] you declared the function: int blit_image(char chemin[15],SDL_Surface *fenetre,int posx,int posy) { So that that parameter #1 has 15 characters. But when you call it, you call it with: blit_image(“resources/images/fondblanc.bmp”,fenetre,0,0); That filename is 31-characters by my counting, and will not fit into 15 characters. I also added some printf-statements to your code which will help … Read more

[Solved] can you help me in this (C lang)? [closed]

[ad_1] /* with thanks to @AduaitPokhriyal */ #include <stdio.h> int main(int argc, char *argv[]) { char command[100]; /* i hope this is large enough! */ sprintf(command, “grep %s %s”, argv[1], argv[2]); /* i hope the arguments are there and valid! */ system(command); /* surely “grep” must use strstr() somewhere */ return 0; } 0 [ad_2] … Read more

[Solved] How to create a log file in c# for windows application? [closed]

[ad_1] I would be doing you a disservice to give you “code for logging”, but I can point you towards the File class, which contains useful methods for writing text to a file. Since you specify no other needs, I suspect it will suffice. File http://msdn.microsoft.com/en-us/library/system.io.file.aspx [ad_2] solved How to create a log file in … Read more

[Solved] consider x^i+y^i=z^i, x

[ad_1] There is a popular math theorem – Fermat’s Great (Last) Theorem – that states for any integer n > 2 there does not exist non-zero integers a, b, c such that a^n + b^n = c^n. 2 [ad_2] solved consider x^i+y^i=z^i, x

[Solved] Regular expression to search for files and folders [closed]

[ad_1] Here shows you how to use regex in C#. You could always just loop the directory that you’re looking in and check the file names instead of making a regex. (You’ll need to use System.IO) Perhaps something like this? string [] fileEntries = Directory.GetFiles(targetDirectory); Regex regex = new Regex(“target file name”); Match match = … Read more