#define BUFSIZE 256
int escape_single_quotes(char *to, char *from, int max)
{ int l= 0;
for (;*from;from++)
{
switch (*from) {
case '\'':
if (l>=max-4) return 0; // not enough space for escaped chars!
// replace ' with '\''
*(to++)= '\'';
*(to++)= '\\';
*(to++)= '\'';
l += 3;
default:
if (l>=max-1) return 0; //
Problem: Use a 2 dimensional static array with 3 rows & 2 columns to the course number and number grade you have received in that course. The program should have three functions called get information, printinformation, and convert. You need to send array to getinformation and printinformation functions as parameters. The get information will ask for course no.
I have a question of char array argument passing.
Hi everyone,I got error when I run this program. I am using ubuntu 11.10.
This is my program.
So my code is
#include <stdio.h>
#include <string.h>
main()
{
char *a="123456789abcdef";
char b[10];
int i=0;
while((b[i]=a[i])!='\0')
++i;
printf("%s %d\n",b,strlen(b);
return 0;
}
The code exists a array overflow with array b, but when I compile it with gcc(version 4.6) in my system (64bit ubuntu 12.04 lts),it succeed.
The output of this program is
Code of baul :)
Code:
/*
* Hanx [Proyecto Fedora Peru] wth Code
* crc.c - app
*
* This program is private version, for anti-educational purposes and without any
* explicit or implicit warranty; in no event shall the author or
* contributors be liable for any direct, indirect or incidetal damages
hello
i have made a small program to find the md5 checksum of a string.i am using xshell to compile the program.
Code:
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <md5.h>
int main(int argc, char * argv) {
MD5_CTX context;
I was reading Kernighan Ritchie book chapter 4 which deals with character pointers.
I am not able to understand following different type of declarations
Code:
char aname[][15] = { "Illegal month", "Jan", "Feb", "Mar" };
char amessage[] = "now is the time";
char *name[] = { "Illegal month", "Jan", "Feb", "Mar
Hi everyone, I'm making a multimedia library to speedup vector and matrix computation.
But I'm getting a strange error, in this code
Quote:
void memcpy_unrolled_sse2(void *dst, void *src, int size)
{
int i = 0,
length = (size/16)*16,
length2 = (size/32)*32,
length4 = (size/64)*64,
length8 = (size/128)*128;
char *a = (char *)src;
char *b = (char *)dst;