language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* Copyright 2015 Joseph Landry All Rights Reserved
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
struct pattern {
int ignore;
char *name;
char *patternString;
};
struct pattern patterns[128];
int patternCount = 0;
int addPattern(int ignore, char *name, char *pattern){
pa... |
C | /*
Fonction LS
Projet C - MiniShell - Polytech Nantes 2016
Suggestion amélioration:
- Ajustement graphique
- Ajout d'options
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <time.h>
#include <fcntl.h>
#include <limits.h>
#incl... |
C | #include<stdio.h>
#include<math.h>
int main(){
int t,i;
scanf("%d",&t);
long long unsigned int x,m,n,a;
for(i=0;i<t;i++){
scanf("%llu%llu%llu",&x,&m,&n);
printf("%d\n",x);
a=pow(x,m+1);
printf("%llu\n%llu\n",a,m);
a=a-1;
a=a/(x-1);
a=a%n;
printf("%llu\n",a);
}
return 0;
}
|
C |
#include "libft.h"
#include <stdlib.h>
char *ft_strsub(char const *s, unsigned int start, size_t len)
{
char *sub;
char *start_sub;
if (!s)
return (NULL);
sub = (char *)malloc(sizeof(char) * (len + 1));
if (!sub)
return (NULL);
start_sub = sub;
while (len)
{
*sub = s[start];
start++;
len--;
sub++... |
C | /*
============================================================================
Name : A3Q2.c
Author : Rylee Thompson
Version :
Copyright :
Description : Solution to Assignment 3 question 2: Illustrate that via AVL
single rotation, any binary search tree T1 can be transformed into another
s... |
C | /* hw5_11.c */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
double f,c;
printf("пJū:");
scanf("%lf",&c);
f=(9/5.0)*c+32;
printf("%.2f=ؤ%.2f\n",c,f);
system("pause");
return 0;
}
/* output----------------
пJū:32
32.00=ؤ89.60
-----------------------*/
|
C | #include "dash-parser.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <inttypes.h>
int dash_segment_timeline(const struct dash_segment_timeline_t* timeline, size_t index, int64_t* number, int64_t* start, int64_t* duration)
{
int64_t t;
size_t i, j, step;
t = 0;
for (j = ... |
C | /* New maths game for kids, based on an idea by Michael Mannington
By Bill Bolton,
Software Tools,
P.O. Box 80,
NSW, 2106,
AUSTRALIA
June 14, 1981 Version 1.0 (Initial Release)
*/
#include BDSCIO.H /* useful definitions etc. */
#define STDIN 0 /* CP/M console input */
#define STDOUT 1 /*... |
C | // UART.h
// Runs on LM3S811, LM3S1968, LM3S8962, LM4F120
// Simple device driver for the UART. This version of the UART
// driver uses UART1 instead of UART0 and has fewer character
// I/O functions compared to the example project UART_4F120.
// U1Rx connected to PC4
// U1Tx connected to PC5
// standard ASCII symbo... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* apply_formats.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct directo{
char dname[10],fname[10][10];
int fcnt;
}dir;
void main()
{
int choice=0,i,j;
char f[20];
dir.fcnt=0;
printf("Enter directory name");
scanf("%s",dir.dname);
printf("\n1)Create file\n2)Delete File\n3)Search file\n4)Display File\n5)Exit\nEnte... |
C | /*Author:-Shubhanshu Agrawal IMT2020078*/
/*problem2:-You are given three floats a b c as inputs which represent the length, the breadth of a rectangle and the radius of a circle, respectively. Write a program which gives the output: area of the rectangle, perimeter of the rectangle, area of the circle and circumferenc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <mpi.h>
int isprime(int n) {
int i, sq;
sq = (int) sqrt(n);
for (i=3; i<=sq; i+=2)
if ((n%i) == 0) return 0;
return 1;
}
int main(int argc, char *argv[])
{
int i, p=0, max;
//max=100000000; // 100 million (primes=5761455)
max=2100... |
C | #include<stdio.h>
/*
* Description: Date convert from "year-month-day" format to "year-XXst-day" format.
* Version: 1.0 Date: 2014.06.05
* Author: Jasper Li
*/
static char daytab[2][13]={
{0,31,28,31,30,31,30,31,31,30,31,30,31}, // normal year.
{0,31,29,31,30,31,30,31,31,30,31,30,31} // leap year.
};
// tes... |
C | #ifndef MESSAGES_H
#define MESSAGES_H
#include <sys/types.h>
#include <unistd.h>
#include <cstring>
#include "shared_config.h"
enum class EOpcodes
{
ProtocolStartRequest,
ProtocolStartResponse,
PutRequest,
PutResponse,
GetRequest,
GetResponse,
DataFragment,
DataFragmentAck,
Dump,
... |
C | #include "cli.h"
#include "uart.h"
#include "usbd_cdc_if.h"
#include <string.h>
#include <ctype.h>
#include <stdio.h>
// head of CLI command list
static CLI_CommandItem* head = NULL;
// char buffer where command will be stored
static char commandBuffer[100];
static CLI_CommandItem* CLI_GetMenuItemByCommandName(cha... |
C | #include <stdlib.h>
#include <stdio.h>
typedef struct aux{
int id;
struct aux* mae;
struct aux* pai;
}PESSOA;
void registrar(PESSOA* filho,PESSOA* mae,PESSOA* pai){
filho->mae = mae;
filho->pai = pai;
}
void imprimir(PESSOA p){
if(p.mae != NULL && p.pai != NULL)
printf("id:%i mae.id:%i pai.i... |
C | #include "sysinternals.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#define MAX_FILENAME_LENGTH 1024
static /*@shared@*/const char *get_log_time();
void log_bug(const char *fmt, ...)
{
va_list args;
fprintf(stderr, "[BUG] %s ::", get_log_time());
... |
C | unsigned limit = get_limit();
unsigned total = 0;
while (limit - total > 0) { // wrong: if `total` is greater than `limit` this will underflow and continue executing the loop.
total += get_data();
} |
C | /**
* Assignment 003 - date
*
* Given a date in the format dd/mm/yyyy, this program converts
* the month number to its name and print the date in the format
* '<dd> de <month name> de <year>', using switch/case.
*
* Author: Álvaro A. Costa
*/
#include <stdio.h>
#include <string.h>
int main()
{
int day, mont... |
C | #include<stdio.h>
struct node
{
int no;
struct node * link;
};
void print(struct node *start)
{
while(start!=NULL)
{
printf("%d ",start->no);
start=start->
link;
}
printf("\n");
}
int main()
{
int i,j,flag1,size;
struct node * start=NULL,*temp=N... |
C | #include <stdio.h>
void checkEvenOdd(int n);
int main()
{
int n;
printf("Enter a number:\n");
scanf("%d",&n);
checkEvenOdd(n);
return 0;
}
void checkEvenOdd(int n)
{
if(n%2==0)
printf("Even number\n");
else
printf("Odd number\n");
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flag_manager2.c :+: :+: :+: ... |
C | #include<unistd.h>
void ft_char_swap(char *a, char *b)
{
char c;
c = *a;
*a = *b;
*b = c;
}
char *ft_strrev(char *str)
{
int debut;
int i;
int fin;
i = 0;
while (str[i] != '\0')
{
i ++;
}
fin = i - 1;
debut = 0;
while (debut < fin)
{
ft_char_swap (&str[debut], &str[... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* case_flags.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
char buf[1024];
char *cwd = getcwd(buf, 1024);
if (cwd == NULL) {
perror("Get current working directory fail.\n");
exit(-1);
} else {
printf("%s\n", cwd);
}
} |
C | /*convert.c--Զת*/
#include <stdio.h>
int main(void)
{
char ch;
int i;
float fl;
fl = i = ch = 'C';
printf("ch = %c,i = %d,fl = %2.2f\n",ch,i,fl);
ch = ch + 1;
i = fl+2*ch;
fl = 2.0*ch +i;
printf("ch = %c,i = %d,fl = %2.2f\n",ch,i,fl);
ch = 1107;
printf("Now ch = %c\n",ch);
... |
C | /*! \file
* futures.h
* xenon-lib-tiny
* Copyright (c) 2020 Martin Clemons
*
* Very basic 'future' data types with different `promise` types.
* See http://dist-prog-book.com/chapter/2/futures.html
* An unresolved future has `promise` set to 0 (or some undefined value), and
* resolved set to false. Once t... |
C |
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define N 100
#define NUM_TESTS 5
double mean(const double *arr, int n)
{
double sum = 0.0;
for(int i = 0; i < n; i++)
{
sum += arr[i];
}
return (sum/n);
}
double stddev(const double *arr,... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <unistd.h>
#include <sched.h>
#include <string.h>
#include <errno.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <sys/mount.h>
void errExit(char *msg) {
perror(msg);
exit(EXIT_FAILURE);
}
void usa... |
C | /*
* ul_s.c
*
* Created on: Sep 21, 2014
* Author: qwer
*/
#include "ul_s.h"
#include "ul_math_bcd.h"
u8
utf8_to_ucs2 (u8 *in, u16 *out, u8 be)
{
u8 n = 0;
u16 o;
if (in[0] < 0x80)
{
n = 1;
o = in[0];
}
else if ((in[0] & 0xE0) == 0xE0)
{
if ((in[1] != 0) ... |
C | #include <stdio.h>
int main() {
char op;
int x, y, result;
printf("Enter (ex. 2 + 5)\n");
printf(">>");
scanf("%d %c %d", &x, &op, &y);
if (op == '+') {
result = x + y;
} else if (op == '-') {
result = x - y;
} else if (op == '*') {
result = x * y;
} else if (op == '%') {
result = x % y;
} else {... |
C | #ifndef CUMO_INDEXER_H
#define CUMO_INDEXER_H
#ifndef __CUDACC__
#include "cumo/narray.h"
#include "cumo/ndloop.h"
#else
#include "cumo/narray_kernel.h"
#endif
/* A structure to get indices for each dimension.
*
* Note that shapes of each argument NArray are typically equivalent, and
* thus indexer would point the... |
C | #include "Avatar.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/*
* Username: sdmahade
* Name: Siddhesh Mahadeshwar
* File Description: This file is responsible for all the actions related to managing the
* avatar of the user. It has functions such as creating and initializing
* the avatar and... |
C | #include<windows.h>
void gotoxy(int x,int y)
{
COORD c;
c.X=x;
c.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);
}
main(){
for(int i=5;i<20;i++)
{
gotoxy(20,i);
printf("Hellow");
}
getch();
}
|
C | //PROGRAM TO ADD TWO NUMBERS
#include<stdio.h>
#include<conio.h>
void main()
{
int num1;
int num2;
int sum;
clrscr();
printf("\n\n ENTER THE FIRST NUMBER:\t");
scanf("%d",&num1);
printf("\n\n ENTER THE SECOND NUMBER:\t");
scanf("%d",&num2);
sum = num1 + num2;
printf("\n\n SUM OF %d AND %d IS %d",num1,nu... |
C | #include<stdio.h>
#include<curses.h>
#include <stdlib.h>
void Le_vet(int tamanho, float *vet)
{
printf("Preencha o vetor\n");
for(int i = 1; i<=6; i++)
{
scanf("%f", &vet[i]);
}
}
void Imprime(float *vet)
{
for(int i = 1; i<=6; i++)
{
printf(" Posicao [%d] %0.2f\n", i, vet[i]);
}
}
float Maior(float *vet)... |
C | #include<sys/epoll.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include<unistd.h>
#include<stdio.h>
#include<string.h>
#include<fcntl.h>
#define EPOLLSIZE 10000
int main()
{
//创建sockfd
int listenfd=socket(AF_INET,SOCK_STREAM,0);
int clientfd,len,epollfd,nread... |
C | // =============================================================================
// Project: Bracket-matching example of stack usage File: main.c
// Author: Michael and Alice Fischer Copyright: January 2009
// ==========================================================================... |
C | /*
* utn.c
*
* Created on: 19 jun. 2022
* Author: bianky
*/
#ifndef UTN_C_
#define UTN_C_
#endif /* UTN_C_ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include "utn.h"
int myGets (char* cadena, int len)
{
int retorno = 0;
if (cadena != N... |
C | //思路:中序遍历二叉搜索树(从小到大顺序),
//遇到根节点时,分为三部分:左子树,根节点,右子树;
//把左子树的最大节点和根节点连接;根节点和右子树的最小节点连接。
typedef TreeNode Node;
TreeNode* Convert(TreeNode* pRootOfTree)
{
Node* list = NULL;
ConvertNode(pRootOfTree,list);
Node* newhead = list;
while(newhead!=NULL&&newhead->left!=NULL)... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
printf("Enter the number of elements in array:\t");
scanf("%d",&n);
int *a = (int *) malloc (n*sizeof(int));
for(int i=0;i<n;i++)
{
printf("Enter %d element:\n",i+1);
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n-1-i;j++)
{
if(a[... |
C | /* Client.c */
#include <stdio.h> /* fscanf fprintf */
#include <stdlib.h> /* exit */
#include <pthread.h> /* Fun:pthread_create */
#include <string.h> /* Fun:bzero strncmp */
#include <sys/types.h> /* socket */
#include <sys/socket.h> /* send recv socket inet_addr */
#include <netinet/in.h> /* inet_addr */
#includ... |
C | #include <stdio.h>
/* 1.6. , getchar() != EOF 0 1 .*/
main ()
{
int c;
c = getchar() != EOF;
printf ("%ld\n", c);
}
|
C | #include <stdio.h>
#include <string.h>
#include "textFind.h"
int getLine(char s[])
{
memset(s, 0, LINE);
char c = getchar();
while (c=='\n')
c=getchar();
for (int i = 0; i < LINE; i++, c = getchar())
{
if (c != EOF && c != '\n')
s[i] = c;
else
break... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<time.h>
int main(int argc, char *argv[])
{
system("python upgrade.py");
FILE* outputFile;int i;char s[50];
char* filename;char* logname;
char usnme[20];char name[20];
char pas[10];
time_t current_time;
char* c_ti... |
C | /*----------------------------------------------------------------------*/
/* mts-mono.c
This is a modified version of mts-old.c (which was based upon
the original make_test_script.c) to handle the legacy universe
files of SIR and make them compatible with things like Java and
Mono runtime-engines. All thi... |
C | #include <stdio.h>
//Definition for a binary tree node.
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
struct TreeNode* lowestCommonAncestor(struct TreeNode* root, struct TreeNode* p, struct TreeNode* q) {
struct TreeNode* cur = root;
while ((cur->val - p->val) * (cu... |
C | /*
* LCD.h
*
* Created: 2016.11.05. 21:30:29
* Author: Dome
*/
#ifndef _LCD_H_
#define _LCD_H_
#include <inttypes.h>
// LCD interface (should agree with the diagram above)
// make sure that the LCD RW pin is connected to GND
#define lcd_D7_port PORTD // lcd D7 connection
#define lcd_D7... |
C | /*1.编写一个程序,创建一个包含26个元素的数组,并在其中储存26个小
* 写字母。然后打印数组的所有内容
*/
#include <stdio.h>
int main(void)
{
char ch[26];
int i;
for (i = 0; i < 26; i++){
ch[i] = 'a' + i;
printf("%c",ch[i]);
}
printf("\n");
return 0;
}
|
C | #include "lista.h"
int list_get_index(t_list* self,void* elemento,bool (*comparator)(void *,void *)){
int longitud_de_lista = list_size(self);
int i;
int cont = 0;
bool existe = false;
for(i = 0; i < longitud_de_lista; i++ ){
if(!comparator(list_get(self,i),elemento)){
cont++;
}else{
existe = true;
... |
C | #include<stdio.h>
void toBinary(int);
int main(void) {
int number;
scanf("%d", &number);
while(number >= 0) {
toBinary(number);
scanf("%d", &number);
}
return 0;
}
void toBinary(int number) {
int v = 1;
while (v <= number / 2)
v *= 2;
int n = number;
while ... |
C | #include "ad7147_spi.h"
#include "ad7147regmap.h"
WORD AD7147Registers[24];
//---------------------------------
//Function definitions
//---------------------------------
//---------------------------------
//WriteRegistersToAD7147();
//---------------------------------
//This function implements block writes to th... |
C | #include<stdio.h>
int main()
{
int m,n,i,j,g,x,z;
printf("m=");
scanf("%d",&m);
printf("n=");
scanf("%d",&n);
if(m>n)
z=n;
else z=m;
x=1;
for(i=2;i<=z/2;i++)
{
if(m%i==0&&n%i==0)
{
if(i>x)
x=i;
}
}
printf("x=%d\n",x);
... |
C | //
// main.c
// Array
//
// Created by Seoksoon Jang on 2016. 11. 4..
// Copyright © 2016년 Seoksoon Jang. All rights reserved.
//
#include <stdio.h>
int arr[] = {1,3,5,7,8};
// int arr[] = {1,1,1,5,1};
// max array count.
int max_arr_count_index = (sizeof(arr) / sizeof(arr[0])) - 1;
// insert
void insertAt(int*... |
C | #include <stdio.h>
#define SZ 5
void fillPrimes( int Primes[] );
int main() {
int Primes[SZ];
fillPrimes(Primes);
for (int i = 0; i < SZ; i++) {
printf("%3d:%5d\n", i, Primes[i]);
}
return 0;
}
void fillPrimes( int Primes[] ) {
for (int i = 0; i < SZ; i++) {
Primes[i] = i ... |
C | #include <stdlib.h> // malloc
#include <stdio.h>
#include <string.h> // strdup, strcmp
// User structure type definition
typedef struct
{
char *token;
int freq;
} tTOKEN;
////////////////////////////////////////////////////////////////////////////////
// LIST type definition
typedef struct node
{
tTOKEN *dataPt... |
C | /*
* servo.c
*
* Created: 3/10/2016 10:34:58 PM - 12:46 AM
* Author: Sili
*/
#define F_CPU 11059200UL
#define PRESCALER 8
#include <avr/io.h>
#include <util/delay.h>
void servo(unsigned char dutyCycle)
{
OCR2B = ((double)ICR1 / 255) * dutyCycle + 0.5;
}
int main(void)
{
DDRD |= (1 << PD3);
TCCR2A |= (1 <... |
C | #include <stdio.h>
int main(){
int n, i = 0, count = 0;
double media;
do{
scanf("%d", &n);
if(n > 0){
count++;
i += n;
}
} while (n > 0);
media = (double)i / count;
printf("%.2lf\n", media);
return 0;
}1 |
C | #include<stdio.h>
#include<conio.h>
int main()
{ int i,num,is_prime;
printf("\nEnter your number:");
scanf("%d",&num);
is_prime=1;
for(i=2;i<num/2;i++)
if((num%i)==0)
is_prime=0;
if(is_prime==1)
printf("\n%d is a prime number.",num);
else
printf("\n%d is n... |
C | #include "sFTPclient.h"
void portToStr(char sPort[], int dPort){
char tsPort[6];
int i=0;
while(dPort){
tsPort[i++] = dPort%10 + '0';
dPort /= 10;
}
for(int j=i-1;j>=0;j--){
sPort[i-1-j] = tsPort[j];
}
sPort[i] = '\0';
}
int make_stream_client_socket(){
return so... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* convert_print.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
// definicion y prototipos funciones
//variables y constantes
// implementacion de funciones
int main(int argc, char** argv) {
float arreglo[100];
arreglo[0]=2;
arreglo[1]=3;
printf("El valor en la posicion 0 es %f \n", arreglo[0]);
... |
C | typedef struct{
double x;
double y;
}Point;
typedef struct{
Point a;
Point b;
Point c;
}Triangle; |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct PEG_STRUCT{
int max_disks;
int num_disks;
int* disks;
char name[6];
} Peg;
void towers_of_hanoi(int num_disks);
void move_tower(int disk, Peg* src, Peg* dest, Peg* spare);
void move_disk(Peg* src, Peg* dest);
Peg make_peg(const int ma... |
C | #include <stdio.h>
int main() {
char x ;
printf("Enter a character: ") ;
scanf("%c",&x);
/// To check if a character x is vowel or consonant
/// using if else ladder
if ( x =='a' ) {
printf("Vowel\n") ;
}
else if ( x =='e' ) {
printf("Vowel\n") ;... |
C | //Bibliotecas
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <locale.h>
//Constantes
#define tamanho 10
//Variveis
int lista[tamanho];
int ordenado[tamanho];
int opt=-1;
int qtd;
//Prototipao
void menu_mostrar(void);
void lista_mostrar(void);
void lista_gerar(void);
void lista_ler(void);
void lista_l... |
C | #include <stdio.h>
#include <conio.h>
int main()
{
int n,m;
printf("\nnhap so thu nhat n = ");
scanf("%d",&n);
printf("\nnhap so thu hai m = ");
scanf("%d",&m);
printf ("so sanh %d > %d = %d\n",n,m,n>m);
printf ("so sanh %d < %d = %d\n",n,m,n<m);
printf ("so sanh %d >= %d = %d\n",n,m,n>=... |
C | #ifndef _UNINITIALISED_STACK_VAR
#define _UNINITIALISED_STACK_VAR
#define BUFF_SIZE 4096
typedef struct stack_obj
{
int do_callback;
long fn_arg;
void (*fn)(long);
char buff[48];
}stack_obj;
typedef struct use_obj_args
{
int option;
long fn_arg;
}use_obj_args;
static void uninitialised_callbac... |
C | // Header: UART
// File Name: UART.c
// Author: chengmengmegn
// Date:
#include "SystemClock.h"
unsigned int SysClock=0;
void Delayms(unsigned int time)//延时等待
{
unsigned int timeNow=SysClock;
while(time!=0)
{
if(timeNow!=SysClock)
{
timeNow=SysClock;
time--;
}
}
}
void Delayus(void) //Delay10us误... |
C |
//------------------------------------------------------------------------
//START OF ARDUINO CONTROLLED ROBOT (Motors) ROUTINES
/*
* sets up your arduino to address your SERB using the included routines
*/
struct vectorMove {
int Speed;
short Direction;
};
void initMots(){
// Declare L298N Dual H-Bridge Motor ... |
C | #include "sockets.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <sys/ioctl.h>
#define BUFF_SIZE 1024
#define PORT 8080
static char *IP_ADDR;
static int isHost;
static int server_fd, openSocket_fd;
s... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int n, *gen, *lut;
int inGen(int num){
int i;
for(i = 0; i < n; i++){
if(num == gen[i]){
return 0;
}
}
return 1;
}
int f(int num){
if(lut[num] != -1){
return lut[num];
}
else{
if(inGen(num) == 0){
lut[num] = 0;
retur... |
C | #include <stdio.h>
void nextStep(int curR,int curC,int step);
int N,R,C;
int leastStep = __INT_MAX__;
int s_Row,s_Col,f_Row,f_Col; //紀錄S跟F的位置
char maze[505][505];
int walked[505][505]; //紀錄走過的格子
int main(){
scanf("%d",&N);
for(int i = 0;i<N;i++){
scanf("%d %d",&R,&C);
for(int j =... |
C | #include<stdio.h>
int main(int argc, char * argv[])
{
char *p = NULL;
int a = 1, b = 2, c = 3;
int d = 7, e = 100;
double f = 0.5; //在64位的机器上占8个字节64位
float g = 0.5;
float i = 17.2365;
printf("%d\n\t%d %d\n %d %d\t\b%d\n",a,b,c,a,b,c);
printf("%d %x %f %f\n", d, e, f, g);
printf("%f\n", i);
printf("%%d ' \"\... |
C | /*
* qiprog - Reference implementation of the QiProg protocol
*
* Copyright (C) 2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without ... |
C | #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
main(int argc,char * argv[]) {
int fd,fd2;
int nbytes;
char buffer[128];
if (argc==1) {
printf("Ejemplo25: Ejemplo25 archivolectura");
exit(1);
}
/*Abrir el archivo indicado*/
fd = open(argv[1],O_RDONLY);
fd2=dup2(fd,0);... |
C | /* minls.c
* Joseph Alfredo
*/
#include "minixlib.h"
void printUsageInfo(){
printf("usage: minls [ -v ] [ -p num [ -s num ] ] "
"imagefile [ path ]\n");
printOption();
}
void initInfo(info_t *info){
info->image = NULL;
info->path = "/";
info->primaryPart = -1;
info->subPart = -1;
info->varbose = 0;
inf... |
C | /*
* 2017.06.04 - Created, based on ideas from:: http://people.sc.fsu.edu/~jburkardt/c_src/ziggurat/ziggurat.html
*
* References: George Marsaglia, Wai Wan Tsang,
* The Ziggurat Method for Generating Random Variables, Journal of Statistical Software, Volume 5, Number 8, October 2000, seven pages.
*/
#i... |
C | #include<stdio.h>
#include<stdlib.h>
struct clinkedlist
{
int item;
struct clinkedlist* next;
};
struct clinkedlist* insert_beg(struct clinkedlist * last,int value)
{
struct clinkedlist * temp;
temp = (struct clinkedlist*)malloc(sizeof(struct clinkedlist));
temp -> item = value;
if (last == NULL) ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 2-0-ft_strdup2.c :+: :+: :+: ... |
C | /*
Author: Mariam Ahmed Abdeltawab
Date: 7/2/2021
This program determines if the input is a character or not.
*/
#include <stdio.h>
int main()
{
char ch;
printf("Please enter the character that you want to check \n");
scanf("%c", &ch);
if( (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))
... |
C | #ifndef SERIAL_H
#define SERIAL_H
/* Functions to assist serialising of data structures */
#include <stdio.h>
#include "common.h"
typedef struct
{
uint8_t *sdata;
int16_t len;
} SerialData;
/* Macros to get an set bits in an 8 bit datatype. x is the byte to set the bit in, b is the bit number (0 is the 'left-most... |
C | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <stdlib.h>
#define SIZE 100
int main(int x, char * argv[]) {
struct sockaddr_in client;
int ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* octal2.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int arr[5];
int i,a,j;
for(i=0;i<5;i++)
{
printf("Enter the %d array element:",i+1);
scanf("%d",&arr[i]);
}
for(j=0;j<5;j++)
{
for(i=0;i<=5;)
{
if(arr[i+1]<arr[i])
{
a=arr[i];
arr[i]=arr[i+1]... |
C | /*
digitek_printer.h
Definition for the Digitek DT-9062 multimeter utility.
*/
#include "digitek_printer.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <string.h>
/* Program processing variables. */
digitek_screen screen;
digitek_state program_state... |
C | #include<stdio.h>
int main()
{
int i,n,t1=0,t2=1,t;
printf("\n Enter number of terms:");
scanf("%d",&n);
printf("\nFibonacci series");
for(i=1;i<=n;++i)
{
printf("%d\n",t1);
t=t1+t2;
t1=t2;
t2=t;
}
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
int main(int argc, char const *argv[]){
int sum = 0;
int beg = atoi(argv[1]);
int end = atoi(argv[2]);
for (int i = beg; i <= end; i++){
sum += i;
}
printf("%d\n", sum);
return 0;
} |
C | /**
* 顺序线性表使用示例
* @author hongker
* @version 1.0
*/
#include <stdio.h>
#include "SeqList.h"
int main() {
//初始化线性表
SeqList List;
Init(&List);
printf("线性表长度: %d\n", Length(&List));
Add(&List,1994);
Add(&List,2008);
if(IsEmpty(&List)) {
printf("线性表为空\n");
}else {
printf("线性表不为空\n");
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sc.h>
int main(int argc, char *argv[])
{
session *s;
session_init(&argc, &argv, &s, "Pingpong_A.spr");
if (argc < 3) return EXIT_FAILURE;
int M = atoi(argv[1]);
int N = atoi(argv[2]);
printf("M: %d, N: %d\n", M, ... |
C | //
// Created by Valentin on 10/24/2019.
//
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "../Headers/log_file.h"
static FILE *output;
static const char format_specifier[7][4] = {
"c",
"d",
"li",
"lu",
"lli",
"llu",
"s"
};
static void append_buffer(char *buff... |
C | #include <stdlib.h>
#include <stdio.h>
#include <ISO_Fortran_binding.h>
#include "dump-descriptors.h"
extern void ctest (CFI_cdesc_t *a, CFI_cdesc_t *b);
extern void ftest2 (CFI_cdesc_t *a, CFI_cdesc_t *b);
struct m {
int i;
int j;
};
#define imax 10
#define jmax 5
void
ctest (CFI_cdesc_t *a, CFI_cdesc_t *b)
{... |
C | #include <unistd.h>
#include <ctype.h>
#define BUFSIZE 1024
int main(void)
{
char readBuff[BUFSIZE];
ssize_t n;
write(STDOUT_FILENO, "Enter something\n", 17);
while ((n = read(STDIN_FILENO, readBuff, BUFSIZE)) > 0)
{
//write(STDOUT_FILENO, readBuff, n);
for (int i = 0; i < n; i++)... |
C |
/*
* Dated : 05/August/2014 , 16:43PM
* Author Amber N Pachauri
* Purpose: This is TurboC 3.0/ DOS program utility created with concept
* of Virtual-Machine, and it runs based on commands being passed
* with each command instruction is in itself encrypted data
* for which gets decoded and stored and read ba... |
C | #include <stdio.h>
void multiplyBy2(float values[], int size)
{
for(int i = 0; i < size; ++i)
values[i] *= 2;
}
int main()
{
void multiplyBy2(float values[], int size);
float values[4] = { 1.2f, -3.7f, 6.2f, 8.55f };
multiplyBy2(values, 4);
for(int i = 0; i < 4; ++i)
printf("%.2f ", values[i]);
... |
C | // set.h ... interface to simple Set of Strings
// Written by John Shepherd, September 2015
// Adapted for use by z5260633 for COMP2521 Assignment 2 (August 2019)
#ifndef SET_H
#define SET_H
typedef struct Node *Link;
typedef struct Node {
char *val;
double pr;
double temp;
Link next;
} Node;
typedef struct Se... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tokens.h"
#ifndef HEAP_H
#define HEAP_H
typedef struct TreeNode {
int frequency;
char* word;
char* code;
struct TreeNode* left;
struct TreeNode* right;
} TreeNode;
TreeNode* TreeNode_create(int frequency, char* word);
TreeNode* TreeNode... |
C | /*
CH-230-A
a7_p5.c
Qais Qamhia
qqamhia@jacobs-university.de
*/
#include <stdio.h>
#include <stdlib.h>
// Returns a positive value if the first number is larger than the second,
// a negative value if the second is larger and 0 if equal
int sort_ascend(const void* a, const void* b)
{
const int* ptr_a = (const in... |
C | #include <stdlib.h>
#include <stdio.h>
#include "loops.h"
typedef struct node {
int val;
struct node* right;
struct node* left;
} bstNode;
bstNode* makeNode(int val)
{
bstNode* newNode = (bstNode*) malloc(sizeof(bstNode));
newNode->val = val;
newNode->left = NULL;
newNode->right = NULL;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.