language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "unp.h"
void
sctp_print_addresses(struct sockaddr_storage *addrs, int num)
{
struct sockaddr_storage *ss;
int i,salen;
ss = addrs;
for(i=0; i<num; i++){
printf("%s\n", Sock_ntop((SA *)ss, salen));
#ifdef HAVE_SOCKADDR_SA_LEN
salen = ss->ss_len;
#else
switch(ss->ss_family) {
case AF_INET:
salen... |
C | #include "communication.h"
void init_servers(server* servers, const int nb_serv, int port_start,
const int max_connexions) {
int iteration, bourse=1, type;
for (iteration=0; iteration < nb_serv; iteration++) {
char name[128];
if (iteration==0){
sprintf(name, "Réseau inter-boursier"); type=interb;
}else {
... |
C | /*
============================================================================
Name : armadura.c
Author : Cardozo Sergio
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#inc... |
C | #include "libft.h"
char *ft_strnstr(const char *haystack, const char *needle, size_t len)
{
size_t i;
size_t k;
i = 0;
if (!*needle)
return ((char*)haystack);
while (haystack[i] && i < len)
{
if (haystack[i] == needle[0])
{
k = 1;
while (needle[k] && haystack[i + k] == needle[k] && (i + k) < len)
... |
C | #include<stdio.h>
int main(int argc, char *argv[])
{
int i;
printf("argc = %d\n",argc);
for(i=0;i<argc;i++)
printf("argv[%d] = %s\n",i,argv[i]);
printf("*(argv[2]+2) = %c\n",*(argv[2]+2));
printf("*((argv+2)+2) = %c\n",*(*(argv+2)+2));
getchar();
return 0;
}
/* 26_commandLine-1.exeĿ¼ʹʾ(c̸Ŀ¼)
C:\>26_comm... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{ char a, b , c ,d;
printf("Digite 4 letras do seu nome:");
scanf("%c %c %c %c", &a, &b, &c, &d);
printf("%c%c%c%c", a,b,c,d);
return 0;
}
|
C | # define _CRT_SECURE_NO_WARNINGS
#include "game.h"
void game()
{
char show[ROWS][COLS] = { 0 };//ʾӡǰ
char mine[ROWS][COLS] = { 0 };
int bomb = ROW * COL - BOMB_NUM;
Initboard(show, ROWS, COLS, '0');//ʼ
Initboard(mine, ROWS, COLS, '*');
PrintBoard(mine, ROW, COL);//ӡ
//PrintBoard(show, ROW, COL);
SetBoard(... |
C | /***********************************************************************
* Advanced Programming Techniques
* Semester 2 2015
* Jeremy John Mercer
* Start up code provided by Paul Miller
* Some codes are adopted here with permission by an anonymous author
**********************************************************... |
C | #include<stdio.h>
int mod(int x,int y,int n)
{
if(y==0)return 1;
int result,res;
res=mod(x,y/2,n);
result=(res*res)%n;
if(y%2!=0){
result=(result*(x%n))%n;
}
return result;
}
int main()
{
int ans,i,x,y,n,test_case;
while(1){
scanf("%d",&test_case);
if(test_case==0)break;
for(i=1;i<=test_case;i++){
s... |
C | /* Created by dtheo */
/* To use with counter.h */
void fill_binary(char *binary, long n, int bc) // Fill *binary with n in binary base
{
int i;
i = bc - 1;
while (i >= 0)
{
if (i % 5 == bc % 5)
*(binary + i) = ' ';
else
{
*(binary + i) = n % 2 + '0';
n /= 2;
}
i--;
}
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_iuxs_bonus.c :+: :+: :+: ... |
C | /*
* ayuan003_project.c
*
* Created: 3/8/2018 11:24:44 AM
* Author: student
*/
//work on joystick and game logic
//init hit miss score so far...
//whammy if time, maybe bluetooth
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include "io.h"
#include "shift.h"
#include "scheduler... |
C | /*
** EPITECH PROJECT, 2019
** asm
** File description:
** my_errno.h
*/
#ifndef ASM_ERRNO_H_
#define ASM_ERRNO_H_
#include <stdbool.h>
typedef enum MY_ERRNO_VALUES
{
E_SUCCESS,
E_NO_NAME,
E_NO_COMMENT,
E_TOO_LONG_NAME,
E_TOO_LONG_COMMENT,
E_INTERNAL_ERROR,
E_INVALID_SYNTAX,
E_INVALID... |
C | #include<stdio.h>
void main(){
int a, remainder, result, q;
printf("enter a number to check whether it is a palindrome or not");
scanf("%d", &a);
q=a;
while(q!=0){
remainder = q%10;
result = result*10 + remainder;
q = q/10;
}
if(result == a){
printf("... |
C | #include <cs50.h>
#include <stdio.h>
long askccnumber(void);
int length (long n);
int main(void)
{
//prompt user for a number until they cooperate by calling function number()
long ccnumber = askccnumber();
int cclength = length(ccnumber);
//check that length of ccnumber is one of thr... |
C | #include <stdio.h>
int main()
{
int i,j;
for(i = 1; i<=9; i++) {
for (j=1; j<=9; j++){
printf("%d\t",i*j);
}
printf("\n");
}
return 0;
}
|
C | /* Authoer: Xu Ji
Need sudo.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <stdint.h>
#include <unistd.h>
const uint64_t GB_size = 1024 * 1024 * 1024;
int main(int argc, const char *argv[])
{
if (argc < 2) {
perror("Usage: GBs to occupy.\n");
}
uint64_t GBs = atoi(... |
C | #ifndef __PERLS_MATH_SO3_H__
#define __PERLS_MATH_SO3_H__
#include <string.h>
#include <assert.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
#include "fasttrig.h"
/*
% ROTX Compute a rotation matrix about the X-axis.
% R = ROTX(PHI) returns [3x3] rotation matrix R. Note: PHI
% is measured in radia... |
C | #include "world_type.h"
#include "simulation.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <cassert>
using namespace std;
void
initWorld(world_t &world, const string &speciesFile,
const string &worldFile)
{
// initialize the struct worl... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "funcionesUTN.h"
#include "misValid.h"
#define EMPLEADOS 6
#define TRUE 1
#define FALSE 0
int isValidStringInt(char cadena[])
{
int i=0;
while(cadena[i]!= '\0')
{
if(cadena[i]<'0' || cadena[i]>'9')
return 0;
i++... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <complex.h>
//Countervariables: i and j:
int i=0;
int j=0;
int k=1;
int l=0;
int m=0;
//Function main:
int main(void) {
printf("\nPlease enter the number of iterations of the Fibonacci calulations: (1-40)");
scanf("%d",&i);
whil... |
C | struct listNode* createNode(int value){
struct listNode* temp = (struct listNode*)malloc(sizeof(struct listNode));
temp->value = value;
temp->nextNode = NULL;
return temp;
}
struct listNode* insertTail(struct groupNode* group,int value){
if(group->firstNode==NULL){
group->firstNode=createNode(value);
... |
C | #include <stdio.h>
float func(float x, float y){
return (x*x + y);
}
void RungeKutta(float x0, float y0, float xn, float h){
float k1, k2, k3, k4, k5, x = x0, y = y0;
printf("\nx\ty");
printf("\n%.5f\t%.5f",x,y);
while(x < xn){
k1 = h * func(x, y);
... |
C | #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
void decimal_to_hexadecimal_octal(int);
void binary_to_hexadecimal_octal(char []);
int octal_hexadecimal_to_decimal(char []);
void octal_hexadecimal_to_binary(char []);
int binary_to_decimal(char []);
int decimal_to_binary(char []);
char hex[] = {... |
C | #include<stdio.h>
int entropy_calc(long byte_count[], int length)
{
float entropy;
float count;
int i;
/* entropy calculation */
for (i = 0; i < length; i++)
{
if (byte_count[i] != 0)
{
count = (float) byte_count[i] / (float) length;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ps_step_2.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "stack.h"
void ShowStack (Stack s) {
printf ("Stack: ");
for (int i=0; i<s.sp; ++i)
printf ("%d ", s.values[i]);
printf ("\n");
}
void GraphStackAux (Stack s, FILE *f) {
fprintf (f, "\t0 [shape=\"record\", label=\"");
for (int i=s.size; i>0; ... |
C | #include "holberton.h"
/**
* puts_half - print half of string
*
* @str: char is str
*/
void puts_half(char *str)
{
int count;
int counting;
while (*str != '\0')
{
count++;
str++;
}
if (count % 2 == 0)
counting = count / 2;
else
counting = (count - 1) / 2;
while (counting != 0)
{
counting--;
... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | // LatLonCoord.cpp: Implementation of the CLatLonCoord class.
//
// Written by Jason Bevins in 1998. File is in the public domain.
//
#include "latLonCoord.h"
#ifdef sgi
#include <math.h>
#include <stdio.h>
#include <assert.h>
#else
#include <cmath>
#include <cstdio>
#include <cassert>
#endif
// Format strings fo... |
C | // These are functions that are defined and implemented
// by the Lua engine, in file LuaEngine.cpp. All these
// functions are in the "mosync" Lua name space.
//
// The following declarations are meant to be used by
// tools that produce documentation support, like the
// ZeroBrane Studio IDE.
//
// This file is not i... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_write_middle_width.c :+: :+: ... |
C | /* #include "std.h" /Pell */
reset(arg) {
if (!arg) set_light(1);
/* set_light(1); /Pell */
}
init() {
add_action("up"); add_verb("up");
add_action("up"); add_verb("south");
add_action("east"); add_verb("east");
}
up() {
call_other (this_player(), "move_player", "up#players/quantos/plateau/nwplat... |
C | // prms-id: 5469
int count;
class A {
A();
A(const A&); // ERROR - referenced below
public:
A(int) { ++count; }
~A() { --count; }
int operator== (const A& r) { return 1; }
};
int main() {
{
A a (1);
if (a == 2 || a == 1) // ERROR - private copy ctor
;
}
return count;
}
|
C | /* annoGrateWig -- subclass of annoGrator for wiggle data */
#include "annoGrateWig.h"
#include "annoStreamWig.h"
#include "sqlNum.h"
#include "wiggle.h"
static void tidyUp(const struct annoRow *rowIn, struct annoRow **pOutList,
uint primaryStart, uint primaryEnd)
/* This takes a wiggle chunk coming from a .wig/... |
C | //DATA TYPES
/*
#include <stdio.h>
#include <limits.h>
int main()
{
int a;
char b;
float c;
double d;
// The storage size of int data type is 2 or 4 or 8 byte.
//it varies depend upon the processor in the CPU that we use.
// 2 byte for 16 bit processor
// 4 byte for 32 bit processor
//8 byte fo... |
C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<locale.h>
#define QTD 6
#define COMB 3.699
// structs (Ex: typedef struct{.....)
typedef struct{
int numero;
float capacidade;
float status;
} SBomba;
typedef struct{
SBomba infos[QTD];
int cont;
} SPosto;
// prototipos
void... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define _CRT_SECURE_NO_WARNINGS
int main(int argc, char* argv[])
{
int a = 10;
short b = 20;
long c = 30;
long long d = 40;
long c1 = 10l;
long long d1 = 10ll;
printf("%d\n", a);
// 2byte
printf("%hd\n", b);
//... |
C | //write a program to check whether
//a person is eligible for vote or not
#include<stdio.h>
int main()
{
int age;
printf("Enter your age:");
scanf("%d",&age);
if(age>=18)//12>=18(False)
{
printf("Eligible for vote");
}
else
{
printf("Not Eligible for vote");
}
return 0;
}
|
C | #include <stdio.h>
#define SQ(x) ((x)*(x))
int main(){
/*
int i = 1;
while(i<5){
printf("%d^2 = %d\n",i,SQ(i++));
}*/
#ifdef _DEBUG
printf("%s\n", "DEBUG model");
#endif
printf("char = %d\n", sizeof(char));
printf("int = %d\n", sizeof(int));
return 0;
} |
C | #include "PCB705.h"
/***************** RGBLoop **************************/
void RGBLoop(void){
int k, j;;
for(j = 0; j < 3; j++ ) {
for(k = 0; k < 256; k++) {
switch(j) {
case 0: setAll(k,0,0); break;
case 1: setAll(0,k,0); break;
case 2: setAll(0,0,k); break;
}
showStr... |
C | #include <stdio.h>
/**
* main - print all values
* @argc: counter
* @argv: values
* Return: 0 Always
*/
int main(int argc, char *argv[])
{
while (argc--)
printf("%s\n", *argv++);
return (0);
}
|
C | /*! \page10 WDT ָ
*
* \section intro_sec_wdt WDT
*
* - WDT(watch dog timer)ŹʱڷֹϵͳѭȲȷ״̬ÿϵͳλ֮ŹĬϴڹرյ״̬ʱϵͳλʱŹҲᱻرWDT_CONbit5-bit0ܱ6bitдѭ̣дЧ\n
* 1CRC_REGLĴΪ0xA5\n
* 2CRC_REGHĴΪ0x6E\n
* 3дWDTCON\n
* 4CRC_REGLCRC_REGHΪֵ\n
* Note忴Źbit6д'1'ƣκʱֱӽ忴ŹĶ
* \section wdt1 WDT_CON Ĵ
* - WDT_CONдɶR... |
C | /* main.c
* This is a program to practice file input and output
* The input file consists of lines with four numbers
* The four numbers correspond to two points in R^2
* so the line
* 0 0 1 0
* corresponds to (0, 0) and (1, 0)
* For each line, this program computes the distance between the
* two points and o... |
C | #include "libft.h"
void ft_putstr_fd(char *s, int fd)
{
int x;
if (s)
{
x = ft_strlen(s);
write (fd, s, x);
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#define ROW 3
main()
{
int (*p)[4];
int i, j;
p = (int (*)[4])malloc(ROW*4*sizeof(int));
for(i=0;i < ROW;i++)
{
for(j=0;j<4;j++)
{
printf("enter element:\n");
scanf("%d\n",&p[i][j]);
}
}
printf("elements are :\n");
for(i=0;i < ROW;i++)
{
f... |
C | /*
* cirbuf.h
* Header for implementing Circular buffers
*
* Created on: 13-04-2014
* Author: boyhuesd
*/
#ifndef CIRBUF_H_
#define CIRBUF_H_
#include <stdint.h>
#include <stdbool.h>
enum {
bufSize = 12,
elementSize = 512
};
typedef enum elementStatus {
FREE,
READ,
WRITE
} elementStatusT;
typ... |
C | #include<iostream>
using namespace std;
template<typename T>
void Swap(T &a,T &b)
{
T temp;
temp=a;
a=b;
b=temp;
}
template<class T>
void SelectSort(T A[],int n)
{
int small;
for(int i=0;i<n-1;i++)
{
small=i;
for(int j=i+1;j<n;j++)if(A[j]<A[small])small=j;
... |
C | /*
编写一段程序,对代码清单9-12进行如下改写。
1、将字符串的个数3改为更大的数,将其值定义为对象式宏。
2、将字符串的字符数6改为128,将其值也定义为对象式宏。
3、生成读取字符串数组的函数。和练习9-3—样,在读取"$$$$$“时停止读取操作。
4、显示”$$$$$"前输入的所有字符串。
*/
#include <stdio.h>
#include <string.h>
#define NUMBER1 5
#define NUMBER2 128
void put_stary(char s[NUMBER1][NUMBER2],int n){
for (int i = 0; i < NUMBER1; i++) {... |
C |
/******************************DEFINICOES DE ALGUMAS VARIAVEIS************************/
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
#define RESET "\x1B[0m" //cores do texto do terminal
#d... |
C | // Test that scope of "if" condition and statement is cleaned up.
#pragma gnu
typedef int a, b;
int x;
void foo() {
if (sizeof(enum {a})) x = sizeof(enum{b});
else x = b;
switch (sizeof(enum {b})) x = b;
a x, y;
b z, w;
}
/*===
TranslationUnit
ExternalDeclaration
Declaration
DeclarationSpecifi... |
C | #include <stdio.h>
int main(int argc, char const *argv[]) {
char buffer[100];
int i = 0;
i = sprintf(buffer, "Hello %s\n", "world");
//sprintf函数的意义是通过格式化字符串输出到buffer变量中
printf("%d %s\n", i , buffer);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
int detec_vogal(char str, int* i){ // esta funo retorna 1 se o caractere for uma vogal e 0 se for consoante.
if ( (str == 'a') || (str == 'e') || (str == 'i') || (str == 'o') || (str == 'u') ){
(*i)++;
return 1;
}
return 0;
}
void ler(char* str){
gets(str);
}
size_t le... |
C | #include <stdio.h>
int main()
{
float fahr, celsius;
float lower, upper, step;
lower = 0.0; /* lower limit of temperatuire scale */
upper = 300.0; /* upper limit */
step = 20; /* step size */
celsius = lower;
printf("%s\t%s","Cels", "Fahr\n");
while (celsius <= upper) {
fahr = ((celsius*9)/5) + 32;
... |
C | //
// main.c
// TCP-Servidor
//
// Created by Roger Luan on 3/22/16.
// Copyright © 2016 Roger Oba. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#define SIZE 5
typedef struct {
... |
C | #include "apue.h"
// Figure 18.14 Test the isatty function
int main(void)
{
printf("fd 0: %s\n", isatty(0) ? "tty" : "not a tty");
printf("fd 1: %s\n", isatty(1) ? "tty" : "not a tty");
printf("fd 2: %s\n", isatty(2) ? "tty" : "not a tty");
return 0;
}
// $ ./t_isatty
// fd 0: tty
// fd 1: tty
// f... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int boi, peso, x, c, d;
printf("Entre com o numero de bois: ");
scanf("%d", &boi);
printf("\n");
c = 0;
d = 0;
for (x = 1; x <= ... |
C | /**
Program v0.0
@author
@version
@date
*/
// lista de dependencias
#include <stdio.h> // para entradas e saida
#include <stddef.h> // para definicoes basicas
#include <stdlib.h> // para a biblioteca padrao
#include <string.h> // para cadeias de caracteres
#include <stdarg.h> // para tratar arg... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{ int i;
float monthly_interest,amount,yearly_interest,total_interest=0,monthly_payment;
printf("enter the loan amount,the interest rate per year and monthly payment\n");
scanf("%f%f",&amount,&yearly_interest);
monthly_interest=yearly_interest/(12*100);... |
C | /* Program 10_1.c Relay control
*
* This program turns the relay connected to PA5 on and off every second.
*
* Created on: 13-08-2021
* Author: SUNIL PAWAR
*/
#include "stm32f4xx.h"
void delayMs(int n);
int main(void)
{
RCC->AHB1ENR |= 1; /* enable GPIOA clock */
GPIOA->MODER &= ~0x00000C0... |
C | #include <stdlib.h>
#include <stdio.h>
int menu()
{
char buf1[1] = {};
for (int i = 2; i < 5; i++) {
printf("%d. Bai tap 6.%d.\n", i, i);
}
printf("5. Thoat\n");
printf("Lua chon cua ban (2-5) : ");
scanf("%s", buf1);
int a = strtol(buf1, NULL, 10);
return a;
} |
C |
/**
******************************************************************************
* @file
* @authors
* @version V1.0.0
* @date
* @brief
******************************************************************************
*/
#include "san_flash.h"
#include "stm32f10x_flash.h"
/*************************************... |
C | #include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
void *pthread_func(void *arg)
{
fprintf(stdout, "pthread:%d\n", pthread_self());
pthread_exit((void*) arg);
}
int main(int argc, char *argv[])
{
int arg;
pthread_t thread;
pthread_create(&thread, NULL, pthread_func, (void*)&arg);
int *ret;
pthread_join... |
C | #include <stdio.h>
void display();
int n = 5; // global variable
int main()
{
++n; // variable n is not declared in the main() function
display();
return 0;
}
void display()
{
++n; // variable n is not declared in the display() function
printf("n = %d", n);
}
|
C | /*
============================================================================
Name : CTest.c
Author : Q. C.
Version :
Copyright : uncc.cci.cs
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#includ... |
C | /*
PROJECT_LIBS:
+ data_dictionary
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "helper_definitions.h"
#include "data_dictionary.h"
#define dd_check(DDICT)\
{\
if (( DDICT ) == NULL) {\
fprintf(stderr, ERROR_ALERT "Could not open data dictionary.\n");\
exit(EXIT_FAILUR... |
C | #include<stdio.h>
#include<stdlib.h>
#define MAX 40
void quick(int a[],int low,int high)
{
int j;
if(low<high)
{
j=partition(a,low,high);
quick(a,low,j-1);
quick(a,j+1,high);
}
}
int partition(int a[],int low,int high)
{
int i,j,temp,key;
key=a[low];
i=low+1;
j=high;
while(i<j)
{
while(a[i]<=key)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <time.h>
#include <pthread.h>
#include "read_keypad.h"
#include "radix_sort.h"
#include "heap_sort.h"
#define NUMBER_OF_SORTING 3
int *duplicate_array(unsigned size, int *array);
void print_array(unsigned size, in... |
C | //두 자연수 A와 B가 주어진다. (1 ≤ A, B ≤ 10,000)
//첫째 줄에 A+B, 둘째 줄에 A-B, 셋째 줄에 A*B, 넷째 줄에 A/B, 다섯째 줄에 A%B를 출력한다.
#include <stdio.h>
int main(void) {
int a = 0, b = 0;
scanf_s("%d %d", &a, &b);
if (a >= 1 && a <= 10000 && b>=1 && b <= 10000) {
printf("%d\n", a + b);
printf("%d\n", a - b);
printf("%d\n", a * b);
print... |
C | #include"libh.h"
//tokenizing arguments for passing into execvp fun
void argtok(char *arr[],char *str)
{
arr[0]=strtok(str," ");
int i=0;
while(arr[i]!=NULL)
{
i++;
arr[i]=strtok(NULL," ");
}
}
//removes initial whitespaces
void reminitspaces(char *str)
{
int temp=0;
while(str[temp]==' ')
temp++;
strcpy(str,str+temp);... |
C | #include "pipe_networking.h"
/*=========================
server_handshake
args: int * to_client
Performs the server side pipe 3 way handshake.
Sets *to_client to the file descriptor to the downstream pipe.
returns the file descriptor for the upstream pipe.
=========================*/
int server_handshak... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ast.h"
struct symbol {
const char *name;
int type;
struct symbol *next;
} *head = NULL;
void add_symbol(int type_specifier, const char* identifier)
{
if(head == NULL)
{
head = (struct symbol*) malloc(sizeof(struct symbol));
head->type = ... |
C |
// Client side C/C++ program to demonstrate Socket programming
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include "./hpp/bpsUARTData.hpp"
#include <sys/ioctl.h>
#include <unistd.h>
#define PORT 22396
bpsUARTSendDataTypeDe... |
C | //#include <stdio.h>
//#include<stdlib.h>
////一个数组中只有两个数字是出现一次,
////其他所有数字都出现了两次。
////找出这两个数字,编程实现。
//void find(int arr[], int len) {
// int a = 0;
// int i = 0;
// int b = 0;
// int s1 = 0;
// int s2 = 0;
// for (i = 0; i < len; i++) {
// a = a ^ (arr[i]); //a为数组遍历异或后,s1和s2的异或值
// }
// for (i = 1; i <= 32; i++) {
/... |
C | /*
* client.c -- a datagram client for sending xdo messages
*
* Brian "Beej Jorgensen" Hall "Beej's Guide to Network Programming"
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <... |
C | #include<stdio.h>
#include<errno.h>
#include<unistd.h>
#include<sys/shm.h>
#include"s1.h"
#include<string.h>
#include<stdlib.h>
int main()
{
FILE *fp;
int shmid;
void *shared_memory=(void *)0;
struct shared *stuff;
char line[1000];
shmid=shmget((key_t)1334,sizeof(struct shared),0666|IPC_CREAT);
printf("Shmid is %d... |
C | // union inside structure
#include<stdio.h>
struct student
{
union
{
char name[20];
int roll_no;
};
int marks;
};
int main()
{
struct student stud;
char choice;
system("cls");
printf("\n You can enter the name or roll number of the student: ");
printf("\n Do you wan... |
C | #include <conio.h>
#include <windows.h>
#include <locale.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
void dynamic_array_alloc(int*** mas)
{
(*mas) = (int**)malloc(8 * sizeof(int*));
for (int i = 0; i < 8; i++) {
(*mas)[i] = (int*)malloc(8 * sizeof(int));
}
if (!(*mas)) {
... |
C | /* Prueba de notificacion asincrona */
#define _POSIX_C_SOURCE 199309L
#include <unistd.h>
#include <mqueue.h>
#include <signal.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#define TAM_MSG 32
#define DIM_COLA 8
int cuenta_msg = 0;
void enviador(char *ncola);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "arquivos.h"
#include "bufferNRU.h"
#include "BtreeIndex.h"
//cria um novo arquivo de indice contendo apenas a raiz com 0 chaves
int createBtreeIndexFile(){
FILE *indexFile = fopen(INDEXFILENAME, "wb+");
unsigned char zero[INDEXHEADERSIZE] ={0};
... |
C | #include <stdio.h>
int array[5000];
void main()
{
int i,j,k=0,temp=0,n;
printf("Enter the Number which You want to enter in array ");
scanf("%d",&n);
for(i=0;i<n;i++){
printf("Enter %d number : - ",i+1);
scanf("%d",&array[i]);
}
temp=array[0];
for(i=0;i<n-1;i++){
array[i]=array[i+1];
}
array[n-1]=temp... |
C | #include<stdio.h>
#include<string.h>
int Sep(int key); //Count the length of key.
char Rt(char p[],int c,int j);
int main()
{
char p[1000];
int l,m,c,k,o,q,z;
printf("Enter a plain text\n");
gets(p);
z=strlen(p);
printf("Enter a key\n");
scanf("%d",&k);
l=k;
c=Sep(l);
q=z%c;
if(q>0) ... |
C | #include <pthread.h>
#include "filter.h"
#include "log.h"
#include "pipeline.h"
#include "queue.h"
image_dir_t* img_dir;
queue_t* q12;
queue_t* q23;
queue_t* q34;
queue_t* q45;
queue_t* q56;
void* thread1(void* inutilise) {
while (1) {
image_t* image = image_dir_load_next(img_dir);
queue_push(q12... |
C | /*
** build_code_str.c for in /home/tessa_b//proj/ftrace
**
** Made by arnaud1 tessa
** Login <tessa_b@epitech.net>
**
** Started on Wed Jun 29 18:48:55 2011 arnaud1 tessa
** Last update Wed Jun 29 19:26:19 2011 arnaud1 tessa
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dot.h"
char *... |
C | double myPow(double x, int n) {
if(n == 0)
return 1;
if(n == 1)
return x;
int is_neg = 0;
if(n < 0){
n = -n;
is_neg = 1;
}
double df = myPow(x,n/2);
df *= df;
if(n % 2 == 1)
df *= x;
return is_neg ? 1 / df : df;
}
|
C | #include"mpi.h"
#include<stdio.h>
int main(int argc, char *argv[])
{
int rank,size,arr[50],x;
MPI_Init(&argc,&argv);
int buf[100];
int s=100;
MPI_Buffer_attach(buf,s);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
MPI_Comm_size(MPI_COMM_WORLD,&size);
MPI_Status status;
if(rank==0)
{
fprintf(stdout,"Enter %d eleme... |
C | #include "uls.h"
/*################################################################*/
//создание трехмерного массива, заполнен символами конца строки
static void arr_init_3p(int argc, int number) {
in_data.str_directory = (char***)malloc(sizeof(char**) * (argc));
for (int i = 0; i < argc; i++) {
in_data.str_di... |
C | #include "cs1010.h"
#include <math.h>
long number_of_non_square_number(long min, long max){
long squares[max+1];
long j =0;
while(j<max+1){
squares[j] = 0;
j +=1;
}
long i =min;
while(i<max+1){
double temp = sqrt(i);
long temp1 = temp;
if(temp... |
C | //Write a C program to concatenate two strings using pointers.
#include <stdio.h>
#include<stdlib.h>
#define MAX 100
void my_strcat(char *p,char *q)
{
int i,j;
for(i=0;*(p+i)!='\0';i++);
for(j=i,i=0;*(q+i)!='\0';i++,j++)
*(p+j)=*(q+i);
*(p+j)='\0';
}
int main()
{
char p[MAX],q[MAX]=... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define ROW 4
#define LINE 3
#if 0
int main() {
int a[22][22] = { 0 };
int x, y;
scanf("%d%d", &x, &y);
int i, j;
a[1][1] = 1;
for (i = 1; i <= LINE; i++){
for (j = 1; j <= ROW; j++) {
if (i == x + 1 && j == y + 1 || i == 1 && j == 1) {
continue;
}
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* gnl.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(){
int k;
int n, m;
int x,y;
int qx, qy;
while(1){
scanf("%d", &k);
if(k == 0)
break;
scanf("%d %d", &n, &m);
while(k--){
scanf("%d %d", &x, &y);
qx = x-n;
qy = y-m;
if(qx == 0 || qy == 0)
printf("divisa\n");
else{
if(qx > 0){
if(qy>0)
... |
C | #include<stdio.h>
main(){
int num;
int*ptr;
num=5;
ptr=#
printf("num:%d\n",num);
printf("address of num:%p\n",&num);
printf("pointer ptr:%p\n",ptr);
printf("value of*ptr.%d\n",*ptr);
}
|
C | /*
* downlink_frame.h
*
* Created: 10/16/2015 4:06:53 PM
* Author: Nigil Lee
*/
#ifndef DOWNLINK_FRAME_H_
#define DOWNLINK_FRAME_H_
#include <stdint.h>
#define PACKET_BYTE_LEN 33 // One extra byte for the DMA command if used
#define FRAME_MAX_PACKETS 12
#define FRAME_MAX_SIZE FRAME_MAX_PACKETS... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ASTInterpreter.h"
#include "DevTools.h"
#include "Hashing.h"
ObjectPointer evaluate(ASTFrame *frame, Node *node);
ObjectPointer primIntAdd(ObjectPointer left, ObjectPointer right) {
int leftValue = getInt(left);
int rightValue = getInt(righ... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
// #define SIZE 15 //BOUNDRY
#define CHARSIZE 2
// void initRecordBorard(void);
// void recordtoDisplayArray(void);
// void displayBoard(void);
int clearscreen(){
system("cls");
system("clear");
}
//ʹõGBK룬ÿһַռ2ֽڡ
//̻ģ
char display_board_array[BOUN... |
C | #include "tree.h"
void STinit() {
head = NULL;
}
link newNode(Item item, link l, link r, int N) {
link x = (link) malloc(sizeof(struct node));
x->item = item;
x->l = l;
x->r = r;
x->N = N;
return x;
}
link search(link h, Key v) {
if (h == NULL)
return NULL;
if (eq(v, key(h->item)))
return h;
if (l... |
C | #include <stdbool.h>
#define MAX_TAMANHO_PAISES 1361
struct pais
{
char idpais[3];
int n_total;
int n_ativos;
int n_completou;
int n_abandonou;
int indice;
};
struct paises{
struct pais *tabela[MAX_TAMANHO_PAISES];
};
struct paises *criar_hashTable();
struct paises *novo_pais();
void... |
C | /*
Sjeng - a chess variants playing program
Copyright (C) 2000-2003 Gian-Carlo Pascutto
File: epd.c
Purpose: run EPD test suite
*/
#include "sjeng.h"
#include "protos.h"
#include "extvars.h"
void setup_epd_line(char* inbuff)
{
int i = 0;
int rankp = 0... |
C | #include <stdlib.h>
#include "alphabet.h"
static size_t alphabet_shift[alphabet_size] = {0};
size_t get_alphabet_shift(char c)
{
return alphabet_shift[c];
}
void init_alphabet_shift(const char *str, size_t len)
{
for (size_t i = 0; i < alphabet_size; ++i) alphabet_shift[i] = len;
for (size_t i = 0; i < l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.