language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
int main ()
{
int i=0,n,sum=0;
A:
i++;
sum=sum+i;
if(i==10)
{
printf("sum = %d",sum);
goto B;
}
goto A;
B:
return 0;
}
|
C | //
// main.c
// 1002
//
// Created by 摆线木偶 on 16/7/31.
// Copyright © 2016年 摆线木偶. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
int sum[10002], max = 0;
for (int i = 0; i < 10002; i++)
sum[i] = 0;
char input;
while (scanf("%c", &input)){
if (!... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sort_four_value.c :+: :+: :+: ... |
C | /// @file utsname.h
/// @brief Functions used to provide information about the machine & OS.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
/// Maximum length of the string used by utsname.
#define SYS_LEN 257
/// @brief Holds information con... |
C | /*
Class: CPSC 346-01 & CPSC 346-02
Team Member 1: Paul De Palma
Team Member 2: N/A
GU Username of project lead: depalma
Pgm Name: ex8.c
Pgm Desc: Demonstrates a system call to copy a file
Usage: ./a.out file_in file_out
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int... |
C | #include <stdio.h>
void main()
{
int m;
printf("Enter a number m: ");
scanf_s("%d", &m);
while (m <= 0)
{
printf("Number m must be greater, than 0. Re-enter m: \n");
scanf_s("%d", &m);
}
printf("Decimal form: 1 Binary form: 1\n");
for (int i = 3; i <= m; i += 2)
{
int i_rank; char is_sym = 1;
for (... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAXINT 32767
#define maxcd 200
#define maxnum 2000
typedef struct
{
int weight;
int parent;
int lchild;
int rchild;
char data;
}HFTree;//0ŵԪʹ
int N;//Ҷ
int M;//
//==============================weight
int CalcuWeight(char code[],char letter[],int w... |
C | // Scrivete una funzione con prototipo void scambia(int *p, int *q) che scambi i valori delle due variabili puntate da p e q.
#include <stdio.h>
void scambia(int *p, int *q){
int t = *p;
*p = *q;
*q = t;
}
int main() {
int p,q;
printf("Inserire due interi p e q: ");
scanf("%d %d",&p, &q);
... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define PI 3.14159265
int main(){
FILE *in;
float dt = 0.00001;
float dx;
float c = 250;
float r;
float *x;
float *phi_inic;
float *phi_prev;
float *phi_now;
float *phi_next;
int points;
int iter;
/*cuerda*/
points = 129;
x = malloc(points*siz... |
C | #include "utilsStr.h"
#include "C99libs.h"
//CC hexNib[16] = "0123456789ABCDEF";
CC hexNib[16] = "0123456789abcdef";
U8 HexNibVal ( U8 nib )
{
if( (nib >= '0') && (nib <= '9') )
return nib - '0';
else
{
// nib = tolower( nib );
nib |= 0x20;
return (nib >= 'a') && ( nib <= 'f') ? nib - 'a' + ... |
C | #include <door.h>
#include <stdlib.h>
#include <err.h>
#include <fcntl.h>
int main(int argc, char** argv) {
// Open the door
int door = open("server.door", O_RDONLY);
if (door == -1) err(1, "Could not open door");
// Call the server's "answer" function
int result = door_call(door, NULL);
if (result == -1) err(... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<fcntl.h>
#include<unistd.h>
int main(int argc, char** argv)
{
int infile, outfile;
char buf[1024];
int num;
if(argc != 3)
{
printf("The format must be:cp file_src file_des");
exit(0);
}
if((infile = open(argv[1], O_RDONLY)) == -1)
{
perror... |
C | #include <stdio.h>
#include <stdlib.h>
#include "matr.h"
//Input: a - matrix (dim * dim), b - matrix (dim * dim)
//Output: none
//stdout: result ('res' matrix);
void matr(double **a, double **b, int dim)
{
//put your source code here
//
double **res;
int i = 0;
int j = 0;
for(;i<dim;i++)
{
for (;j<dim;j++)... |
C | #include<stdio.h>
int main(int argc,char **argv){
int (*(arr[])) = {
(int[]) {1,2,3,4,5} ,
(int[]) {6,7,8},
(int[]) {9,10,11,12},
(int[]) {13,14}
} ;
for(int i=0;i<4;i++){
for(int j=0;j<5;j++){
printf("arr[%d][%d] Address: %p Value: %d \n",i,j,&*(arr[i]+j),*(arr[i]+j));
}
printf("\n");
}
re... |
C | #include<stdio.h>
#include<math.h>
int main () {
int Wa[32];
int F[32] = {0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0};
int i,j;
for(i=0;i<32;i++) {
if(F[i]==0)
Wa[i] = 1;
else
Wa[i] = -1;
printf("%2d",Wa[i]);
}
printf("\n");
... |
C | #include "holberton.h"
#include <stdio.h>
/**
* _strncat - check the code for Holberton School students.
* @dest: destino
* @src: fuente
* @n: integer
* Return: Always 0.
*/
char *_strncat(char *dest, char *src, int n)
{
int contd;
int conts;
for (contd = 0; dest[contd] != '\0';)
{
contd++;
}
for (conts... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tokens_utils.c :+: :+: :+: ... |
C | #define Math_PI 3.1415926
double cot(double x)
{
return 1.0/tan(x);
}
double sec(double x)
{
return 1.0/cos(x);
}
double csc(double x)
{
return 1.0/sin(x);
}
double acot(double x)
{
return atan(1.0/x);
}
double asec(double x)
{
return acos(1.0/x);
}
double acsc(double x)
{
return asin(1.0/x);
}
double Log(double ... |
C | #include<stdio.h>
#include<strings.h>
#include<stdlib.h>
#include "aes.h"
int main(int argc, char *argv[]){
/*
* Figure out how to read the test vectors and use them
* to validate AES. For now just a hardcoded one.
*/
unsigned int space[60];
unsigned char key[32];
unsigned char pt[16];
unsigned char ... |
C | #include "conf.h"
typedef struct configure_t {
char name[50];
char passwd[50];
char ip[16];
short int port;
}configure;
int config_init(conf_t *conf,configure* myconfig){
int ret=0;
if( (ret= conf_getstr(conf, "user", "name", myconfig->name, 50))==-1){
printf("name not exist\n");
};
if((ret = conf_getstr(co... |
C | #include<string.h>
#include <stdlib.h>
#include"ENC.h"
int main(int argc, char** argv)
{
unsigned char *r = (unsigned char*)malloc(16),f[20],Key[17];
FILE *fp,*fq;
long l,t,size;
float per;
if(argc < 2)
{
printf("Enter The Filename to encrypt in the following format :\n\n\n ./enc <filename>\n");
return 0;
... |
C | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "rhhash.h"
struct entry {
struct rh_head rh_head;
char *key;
int val;
};
struct rh_head **buckets;
int bits;
struct entry *get(const char *key) {
struct entry *e;
int k;
long hash = rh_hash_str(key);
r... |
C | #include <stdio.h>
#include "matrixOperations.h"
#include "polynomialOperations.h"
void clearZeroes(float x[]) {
int i;
for(i = 0; i <= maxDegree; ++i) {
if (x[i] < precision && x[i] > -precision) {
x[i] = 0.0;
}
}
}
void add(float addTo[], float addFrom[]) {
int i;
for (i = 0; i <= maxDegree; ++i) {
ad... |
C | #include<string.h>
#include <stdio.h>
void sanitizer(char* buf,char* out,int len){
for (i=0, i<len, i++){
if (buf[i] != '`' && buf[i] != '>' && buf[i] != ';' && buf[i] != '&'){
out[i] = buf[i];
}
else{
return 1;
}
}
return 0;
}
int main(){
char buf[0x20]={0};
char out[0x20]={0};
... |
C | #include <stdio.h>
int main() {
int i;
int int_ans = 1;
long long_ans = 1;
float float_ans = 1;
double double_ans = 1;
for (i = 1; i <= 100; i++) {
int_ans *= i;
long_ans *= i;
float_ans *= i;
double_ans *= i;
}
printf("Int ans = %d\n", int_ans);
pr... |
C | #include<stdio.h>
int main()
{
char str[100];
int i,n,j;
scanf("%d",&n);
if(n<=0||n>50) return 0;
for(i=0;i<n;i++)
{
scanf("%s",str);
printf("String #%d\n",i+1);
for(j=0;str[j]!='\0';j++)
if(str[j]=='Z') putchar('A');
else putchar(str[j]+1);
putchar('\n');
putchar('\n');
}
ret... |
C | /*
when 8-bits are there
LDR: 1-2-25
(rest dec with inc in intensity)
NTC:(31.00.31.50)-33.50-34.00 //-31.50-
(rest dec with inc in temp)
when 16-bits are there
LDR: 1-10-115
NTC:128-133-137
*/
#define F_CPU 16000000UL
#include<avr/io.h>
#include<util/delay.h>
#include<avr/interrupt.h>
void setup_adc();... |
C | #include <stdio.h>
#include <time.h>
#include <stc/crandom.h>
#ifdef __cplusplus
#include <random>
#endif
#define NN 3000000000
int main(void)
{
clock_t difference, before;
uint64_t v;
crand_rng64_t stc = crand_rng64_init(time(NULL));
crand_uniform_i64_t idist = crand_uniform_i64... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "dk_tool.h"
int main() {
int d, a, f, c, q;
char s[100];
printf("Enter D:\n");
while(d < 1) {
checkD(&d);
}
printf("\nEnter A:\n");
while(a < 1) {
checkA(&a);
}
printf("\nEnter F in HEX sy... |
C | # DSA_Assignment_02
#include<stdio.h>
char * GetRomanNumber(char*numbers[],int i);
void main()
{
char *units[] = { "", "I","II","III","IV","V","VI","VII","VIII","IX" };
char *tens[] = { "", "X","XX","XXX","XL","L","LX","LXX","LXXX","XC" };
char *hundreds[] = {"", "C","CC","CCC","CD","D","DC","DCC","DC... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove.c :+: :+: :+: ... |
C | /* String_Distance.c
Author: BSS9395
Update: 2021-09-03T14:57:00+08@China-Guangdong-Zhanjiang+08
Design: String Distance
Platform: Linux
Original: https://blog.csdn.net/shizheng163/article/details/50988023
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* Dynamic ... |
C | #include <stdio.h>
void main()
{
int rn[] = {1, 5, 10, 50, 100, 1000};
int *r;
int x;
for (x = 0; x < 6; x++)
{
r = rn;
printf("%i. %u = %i\n", x + 1, r, rn[x]);
r++;
}
} |
C |
#include <stdio.h>
#include <stdlib.h>
#include "ft_list.h"
void ft_list_push_front(t_list **begin_list, void *data);
int ft_list_size(t_list *begin_list);
t_list *ft_list_last(t_list *begin_list);
void ft_list_push_back(t_list **begin_list, void *data);
t_list *ft_list_push_strs(int size, char **strs);
void ft_list_... |
C | #include "Queue.h"
#include <stdlib.h>
#include <assert.h>
#define MAXQ 6
struct queue {
int nitems;
int head;
int tail;
int items[MAXQ];
};
// create a new empty Queue
Queue makeQueue() {
Queue q = malloc(sizof struct queue);
q->nitems = 0;
q->head = 0;
q->tail = 0;
return q;
}
// delete memory as... |
C |
/*********************************************************
Author: Benjamin R. Olson
Date: 2-25-17
Filename: ftserver.c
Description: OSU Networking CS 372, Project 2
simple FTP server
Usage: ftpserver <port number>
Once running, receives and responds to requests:
If a client requests "-l" (without the quote... |
C | #include <stdio.h>
#include <stdlib.h>
unsigned long int next = 1;
int rand(void)
{
next = next * 1103515245 + 12345;
return ((unsigned int)((next/65536) % 32768));
}
void srand(unsigned int seed)
{
next = seed;
}
int main(int argc, char **argv)
{
int idx = 0;
if (argc == 2)
srand((unsigned int)atoi(argv[1]... |
C | // 习题10-7 十进制转换二进制 (15分)
// 本题要求实现一个函数,将正整数n转换为二进制后输出。
// 函数接口定义:
// void dectobin( int n );
// 函数dectobin应在一行中打印出二进制的n。建议用递归实现。
// 裁判测试程序样例:
// #include <stdio.h>
// void dectobin( int n );
// int main()
// {
// int n;
// scanf("%d", &n);
// dectobin(n);
// return 0;
// }
/... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX 10
typedef struct
{
int data[MAX];
int front, rear;
} queue;
void init(queue *queue)
{
queue->front = queue->rear = -1;
printf("Queue initiallized.\n\n");
}
queue *createQueue(int size)
{
if (size <= 0)
{
printf("Siz... |
C | #include <stdlib.h>
#include <stdio.h>
/* Define a generic type that allows us to store any value inside the
hashtable */
typedef void *any_t;
typedef any_t map_t
/* Define a bucket */
/*
key: Hashing key
data: Value associated with the key
in_use: Whether the bucket is in use or not
*/
typedef struct _has... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* uint.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int sel1 = 0, i;
float s1, s2, s3, s4, s5;
while (sel1 != 3)
{
printf("f(x):ax^2+bx+c (1)\ng(x):ax^3+bx^2+cx+d (2)\nexit (3)\npls u select: ");
scanf("%d", &sel1);
switch (sel1)
{
case 1:
printf("pls u enter 'a' :");
scanf("%f", &s1);
printf("... |
C | /*
* Pydroponics
* CMPE129
* Collaborators
* spister@ucsc.edu
* dgunny@ucsc.edu
*
* File: sysSolenoid.c
* Author: Daniel Gunny
* Created: 05/14/13 8:31
*
*/
#include "GlobalGeneralDefines.h"
#include "sysSolenoid.h"
#include <avr/io.h>
#include <stdlib.h>
#include <util/delay.h>
/************************... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
long x=31, p=5209; // parameters for the hashing function
char *leftOver; // leftover charcters out of a name when reading from file
int leftOverSize = 0; // number of leftover characters
/* struct defines the element of a list from the hash table
* it hold... |
C | #include <stdio.h>
#include <stdlib.h>
/* Just putting the basic algorithm here. This uses BFS. Since all words at a certain level are checked in BFS mode, the first time the word is hit, the shortest length is also found there. */
int
word_ladder (start, end, dictionary) {
while (q not empty) {
Queue.add {start,... |
C | #include "stm32f10x.h"
#include "EIE3810_KEY.h"
void EIE3810_Key_Init(void){
//Enable PE clock
RCC->APB2ENR |=1<<6;
//Enable PA clock
RCC->APB2ENR |=1<<2;
//Configure button PE2
GPIOE->CRL &=0xFFFFF0FF;// (4-bit a register, starting from register 0) Clear up
GPIOE->CRL |=0x00000800;//Set register PE2's mode ... |
C | int power(int a,int b){
int ans = 1;
int i;
for(i=1;i<b;i++){
ans *= a;
}
return ans;
} |
C | #include <stdio.h>
/* MMU Level 1 Page Table Constants */
#define MMU_FULL_ACCESS (3 << 10)
#define MMU_DOMAIN (0 << 5)
#define MMU_SPECIAL (0 << 4)
#define MMU_CACHEABLE (1 << 3)
#define MMU_BUFFERABLE (1 << 2)
#define MMU_SECTION (2)
#define MMU_SECDESC (MMU_FULL_ACCESS | MMU_DOMAIN | \
MMU_SPECIAL | MMU_SECTION... |
C |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main()
{
/*
Flexible array member (struct hack in GCC)
*/
struct flex
{
size_t count;
double average;
double values[]; // flexible array member (last member!)
};
const size_t n = 3;
... |
C | #include "matrix.h"
matrix *transpose2(matrix * in);
matrix *sum2(matrix * mtx1, matrix * mtx2);
matrix *product2(matrix * mtx1, matrix * mtx2);
double dotProduct2(matrix * v1, matrix * v2);
matrix *identity2(int order);
double getElement2(matrix * mtx, int row, int col);
matrix *subtraction2(matrix *A, matrix *B);
ma... |
C | /**
* @file hw07.c
* @brief 십진수 -> 이진수
*/
#include <stdio.h>
#include <stdlib.h>
int get_user_input(void);
int * convert_10_to_2(int input);
void convert_10_to_2_test(int input, int * expected);
void convert_10_to_2_tests(void);
void print_result(int input, int * binary);
int get_digits_needed(int input);
void ... |
C | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
int letterCount(string text);
int wordCount(string text);
int sentenceCount(string text);
int colemanLiau(float letters, float words, float sentences);
int main(void) {
string text = get_string("Text: ");
int le... |
C | #include <stdio.h>
void str_cpy(char * dest, char * orig)
{
int i = 0;
while((dest[i] = orig[i]) != '\0')
i++;
}
int main()
{
char dest[10];
char orig[] = "elizabeth";
str_cpy(dest, orig);
printf("%s\n", dest);
return 0;
} |
C |
typedef struct
{
Int x;
Int y;
}
IntPoint;
typedef struct
{
UInt x;
UInt y;
}
UIntPoint;
STRUCT_NUBLE_TEMPLATE(IntPoint)
STRUCT_NUBLE_TEMPLATE(UIntPoint)
STRUCT_LIST_INTERFACE_TEMPLATE(IntPoint)
STRUCT_LIST_INTERFACE_TEMPLATE(UIntPoint)
NS_INLINE IntPoint IntPoint_create(Int x, Int y) { IntPoint result ... |
C |
#include "header.h"
/*********************************************************************
expand_subtree expands the subtree pointed to by n into sum of
products form, and returns a pointer to the resulting subtree.
Note that the base and exponent subtrees of a POWER node will
not be expanded into sum of p... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sql.h>
#include <sqlext.h>
#include "odbc.h"
int main(int argc, char** argv){
SQLHENV env;
SQLHDBC dbc;
SQLHSTMT stmt;
SQLRETURN ret; /* ODBC API return status */
char consulta[300];
FILE* pf;
int id_usuario, id_venta;
char p_ini[... |
C | // This is a C program that compares strings
#include <stdio.h>
#include <string.h>
int main()
{
char a[100],b[100];
printf("Enter the first string\n");
gets(a);
printf("Enter the second string\n");
gets(b);
/* strcmp(string,string):returns 0 if strings are equal else strings are unequal */
if(strcmp(a,b)=... |
C | #include <stdio.h>
int main(int argc , char *argv[])
{
int array[] = {5,2,7,3,1,6,9,8,0};
int len = sizeof(array)/sizeof(int);
printf("Old Array order:\n");
showSortArray(array,len);
/**********1*************
bubble_sort(array,len);
jiwei_sort(array,len);
SelectSort(array,len);
InsertSort(array,len);... |
C | /********************************************************************************
C implementation of four-parameter Least Squares sine fitting method proposed in
"A Computationally Efficient Non-iterative Four-parameter Sine Fitting Method,
IET Signal Processing, 2021
Input parameters:
- x: D... |
C | /* ChickenOS - fs/deivce.c - generic block/char device layer
* Needs a bit of work
*/
//Ideally we'll have 2 classes of functions
//[block|char]_[read|write]_at -> takes offset/size
//block_[read|write] -> takes block only, used for lowlevel
//access
//then we can have a common struct device again
#include <kernel/c... |
C | #ifndef _MATH_OPERATIONS_LIB_
#define _MATH_OPERATIONS_LIB_
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#define NELEMS(x) (sizeof(x) / sizeof((x)[0]))
//Get the sign of the k-th entry.
#define get_sign(M, entry_idx... |
C | // TODO: Python-style order-preserving mapping https://www.youtube.com/watch?v=p33CVV29OG8
#include <assert.h>
#define EMPTY ((size_t)(-1))
MAPPING MAPPING_CTOR(void)
{
size_t n = 8; // TODO: experiment with different values
MAPPING map = malloc(sizeof(*map) + n*sizeof(map->flex[0]));
assert(map);
map->refcou... |
C | #include <stdio.h>
/* count words lines characters etc */
#define INSIDE_WORD 1
#define OUTSIDE_WORD 0
main() {
int character, number_of_lines, number_of_words, number_of_characters,
current_state;
current_state = OUTSIDE_WORD;
number_of_lines = number_of_words = number_of_characters = 0;
while ( (char... |
C | /*
* Copyright (c) 2016 Sean Parkinson (sparkinson@iprimus.com.au)
*
* 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 restriction, including without limitation the rights
* to us... |
C | #include <stdio.h>
#include <stdlib.h>
#include "LinkedList.h"
#include "utn.h"
#include "Bici.h"
#include "parcer.h"
int main()
{
int opcion = 0;
char salir[3];
char rta;
int opcionBici;
LinkedList* listaPrincipal = ll_newLinkedList();
LinkedList* listaOrdenada= NULL;
Li... |
C | #include <stdio.h>
/**
*main - prints from 1 to 100
* % of 3 with Fizz,
* % of 5 with Buzz
* and % of 3 and % 5 with FizzBuzz
*Return: cero
*/
int main(void)
{
int n;
for (n = 1; n <= 100; n++)
{
if (n % 3 == 0 && n % 5 == 0)
{
printf("FizzBuzz");
}
else if (n % 3 == 0)
{
printf("Fizz");
}... |
C |
#include <stdio.h>
#include <stdlib.h>
#include "project2.h"
/* ***************************************************************************
ALTERNATING BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose
This code should be used for unidirectional or bidirectional
data transfer protocols from A to B and B to... |
C | /*
* anSematico.c
*
* Created on: 10/09/2016
* Authors:
* Hugo Dionizio Santos
*/
#include "anSemantico.h"
SymbolTable typeChecking(ParseTree pTree) {
SymbolTable sTable;
printf ("Checando semântica da sequência e gerando tabela de símbolos...\n");
return sTable;
}
SymbolTable objectBinding(Pars... |
C | //
// MergeSort.c
// MergeSort
//
// Created by T Moore on 4/2/15.
// // Pending Review 4/18/18
// Note on 14 April 19 - This merge sort algorithm is hard coded - need to re do for X amount of line merges
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include <st... |
C | #include "stdio.h"
// Lucas Marchesani
//4Feb19
//Lab4B.c
int main ()
{
int UserInput = 0;
printf("Please input a character please:"); // prompts for userinput
UserInput = getc(stdin); // saves the character and reads it in from stdin
printf("The previous character to your input is "); // print... |
C | #include <stdio.h>
#include <stdlib.h>
#include "insertion_sort.h"
void insertion_sort(int** numbers, size_t size){
size_t j;
for (j = 1; j < size; j++) {
int key = (*numbers)[j];
int i = j - 1;
while(i >= 0 && (*numbers)[i] > key) {
(*numbers)[i+1] = (*numbers)[i];
... |
C | #include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
void init(void)
{
GLfloat mat_specular[] = { 1.0, -1.0, -1.0, 1.0 };
GLfloat mat_diffuse[] = { 0.8, -1.0, -1.0, 1.0 };
GLfloat mat_ambient[] = { 0.2, -1.0, -1.0, 1.0 };
GLfloat mat_shininess[] = { 10.0 };
GLfloat light_position[] = { 1.... |
C | #include<iostream>
#include<cstring>
#include<cstdlib>
#include<map>
#include<vector>
#include<list>
#include<set>
#include<queue>
#include<cassert>
#include<sstream>
#include<string>
#include<cmath>
#include<algorithm>
usin... |
C | /**
* @file
* @brief Main code of the client application
*/
#include "cli.h"
#include "multipath.h"
#include "mp_local.h"
#include "iniparser.h"
//#define exerror(c,z) {fprintf(stderr,"%s Errno: %d\n",c, z); exit(z);}
/**
* Main function of client application that parses the CLI input and sends that to the s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <string.h>
#include "zone.h"
int main(int argc, char** argv) {
struct donnees maFile;
key_t clef;
int idFile;
int ret;
//creation de la file
clef = ftok("/tm... |
C | /*
* Programador: Hernandez Rojas Mara Alexandra Practica 12
* Este programa define las estructuras de nodo y lista*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "e1.h"
void insertar(INFO info, LIST *l){
if(l!=NULL){
if(l->head == NULL){
l->head = crear_nodo();
... |
C | //Copyright:LPH
//Author:
//Date:2020-11-26~2020-11-30
//Description:ƽĻܺ
#include"AVL.h"
AVLNode* CreateAVLNode(ElemType x) //ƽĽ㴴
{
AVLNode* s = (AVLNode*)malloc(sizeof(AVLNode));
assert(s != NULL);
s->BF = 0; //ʼƽ
s->lchild = s->rchild = NULL;
s->data = x;
return s;
}
void... |
C | /// Loads an image file and returns the block of data in 32 bit format. Must be deleted by caller.
char * loadPNG (const char * filename, int & width, int & height);
/// Loads several image files and packs them into a single texture from left to right.
char * loadAtlas (char * filenames [], int numfiles, int & width,... |
C | #include "lists.h"
/**
* delete_dnodeint_at_index - remove node at index of dlistint_t linked list.
* @head: pointer to the head of a linked list.
* @index: index of node that should be deleted, starts at 0.
*
* Return: 1 if it succeeded, -1 if it failed.
*/
int delete_dnodeint_at_index(dlistint_t **head, unsign... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SIZE 50
typedef struct{
char s_name[20];//스케줄 이름
int s_date[3];//시작일
int e_date[3];//종료일
int importance;//중요도
int complete;//완료유무
}Schedule;
int add_schedule(Schedule *p);//스케줄 추가하는 함수
void read_schedule(Schedule p);//스케줄 한개를 읽는 함수
void list_sched... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int palindromo(char str[]){
int i;
for(i=0; i < strlen(str)/2; ++i){
if(str[i] != str[strlen(str) - 1 -i]){
return 0;
}
}
return 1;
}
int main(int argc, char *argv[]){
char str[100];
scanf("%s",str);
printf("%s -> %d\n", str, palindromo(str));... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* b_to_a.c :+: :+: :+: ... |
C | /**
* Write a program to add two numbers.
*/
#include<stdio.h>
// #include<conio.h>
int main () {
int a, b, c;
printf("Enter two numbers :");
scanf("%d%d", &a , &b);
c = a + b;
printf("Sum of the two numbers is %d\n", c);
return 0;
}
|
C | #include<stdio.h>
int main()
{
long n,rv=0,temp; int r;
printf("Enter an Integer\t");
scanf("%ld",&n);
temp=n;
while(n>0)
{
r=n%10;
n=n/10;
rv=rv*10 + r;
}
if (rv==temp)
printf("No is Palindrome");
else
printf("No is Not Palindrome");
return 0;
}
|
C | #include<stdio.h>
#include<math.h>
int b=2;
void sec()
{
int a=5;
printf("a = %d\n",a*=a);
printf("b = %d\n\n",++b);
}
double kvadr(int a)
{
a*=a;
return a;
}
void main ()
{
int a = 9;
char str;
printf("\nФункция <main>\n \n");
printf("a = %d\n",a);
printf("b = %d\n \n",b);
printf("Функция <sec>\n \n");... |
C | #include "example.h"
// From http://ru.wikibooks.org/wiki/Программные_реализации_вычисления_CRC
/*
Name : CRC-8
Poly : 0x31 x^8 + x^5 + x^4 + 1
Init : 0xFF
Revert: false
XorOut: 0x00
*/
uint8_t crc8(uint8_t *buf, size_t len)
{
uint8_t crc = 0xFF;
int i;
while (len--)
{
crc ^=... |
C | /** DEBUGOFF.H
% Author: Manuel Lopez <jmlopez.rod@gmail.com>
% License: http://creativecommons.org/licenses/by-sa/3.0/
% Date Created: November 15, 2013
% Last Modified: November 26, 2013
This file turns off the debugging macros. To use it you must use the
following two sets of code in a file:
#ifdef FILENAME_DE... |
C | /*
** EPITECH PROJECT, 2019
** MUL_my_defender_2018
** File description:
** score
*/
#include "defender.h"
void update_score(game_t *game, play_t **pl)
{
sfVector2f spr_pos = sfSprite_getPosition(pl[krillin]->spr);
sfVector2f pos = {50, 155};
for (int i = krillin; i <= krillin5 + 1; i++) {
if (sp... |
C | /* $Id$ */
#include <assert.h>
#include "ht.h"
static int ary[10]={'A','B','C','D','E','F','G','H','I','J'};
static int hash(i) {return 0;}
static int equal(i,j) {return ary[i]==ary[j];}
int main(int argc,char **argv) {
struct hashtable ht;
int i,j;
ht_init(&ht,1,&hash,&equal);
for(i=0;i!=10;++i) {
print... |
C | #ifdef ONE4ALL_TEST
int main()
{
void* data = memmap(NULL, 0x1000, O_MEM_RWE);
memcpy(data, "\x33\xc0\xc3", 3); // zero out eax and return for x86 / amd64
assert(data != NULL);
assert(((shellcode_t)data)() == 0);
char buff[1024];
zfill(buff); // zero fill buffer
char *p = hexdump_string(data, 16, buff, sizeof ... |
C | #pragma once
#include"common.h"
struct mouseParam {
int x, y, event, flags;
};
void mouseCallBack(int event, int x, int y, int flags, void* data) {
mouseParam* ptr = (mouseParam*)data;
ptr->x = x; ptr->y = y; ptr->event = event; ptr->flags = flags;
}
void EstimateOffset(const string fileName, cv::Size size) {
c... |
C | /*
** direction.c for Zappy in ./server_zappy/modules/zappy_protocol/src
**
** Made by di-mar_j
** Login <di-mar_j@epitech.net>
**
** Started on Thu Jun 23 22:12:26 2011 di-mar_j
** Last update Sun Jul 10 23:15:49 2011 di-mar_j
*/
#include "zappy_protocol.h"
int get_sound_direction(int n, void *player)
{
if (... |
C | /*
取地址运算符& 与 寻址运算符*
*/
#include <stdio.h>
int main(){
int i = 10;
char c = 'a';
//point 取地址&
printf("i address:%p\n",&i);
i = 20;
// 寻址*
printf("*&i->value :%d\n",*(&i));
printf("*&c->value :%c\n",*(&c));
return 0;
} |
C | #pragma once
#include <stdint.h>
#include <config.h>
typedef struct Vector
{
void **data;
uint64_t size;
uint64_t capacity;
} Vector;
Vector *Vector_create();
void Vector_init(Vector *vector);
void Vector_destroy(Vector *vector);
void Vector_push(Vector *vector, void *ptr);
void* Vector_pop(Vector *vector);
void*... |
C | /*
* File: raycast.c
* Author: Matthew
*
* Created on September 29, 2016, 11:37 AM
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
// define what sphere and plane are for 'kind' in 'Object'
#define SPHERE 0
#define PLANE 1
#define MAXCOLOR 255... |
C | #include "../../../inc/mh_list.h"
struct mh_list_node {
mh_memory_t value;
mh_list_node_t *next;
mh_list_node_t *previous;
size_t allocation_index;
};
typedef struct mh_list_private {
mh_list_t base;
mh_context_t *context;
mh_list_node_t *first;
mh_list_node_t *last;
size_t count;
... |
C | #include<stdio.h>
#include<stdlib.h>
#define N 30;
int move[30]= {1,1,22,1,8,1,
1,1,1,1,26,1,
1,1,1,1,-4,1,
-7,29,-9,1,1,1,
1,1,-1,1,1,1};
int snake()
{
int i;
for(i=1;i<=30;i++)
{
if(move[i]<0)
{
return i;
}
}
}
void main()
... |
C | #include"header.h"
/* this function is to insert a node into the tree structure and check for balacing after insertion by traversing back */
struct node *insert(struct node *root, int value)
{
if(root == NULL) {
root = (struct node *)malloc(sizeof(struct node)) ;
root->data = value ;
root->left = NULL ;
root->... |
C | #ifndef TOKEN_H
#define TOKEN_H
// Token
typedef enum {
TK_RESERVED,
TK_IDENT,
TK_IF,
TK_ELSE,
TK_WHILE,
TK_FOR,
TK_RETURN,
TK_NUM,
TK_EOF
} TokenKind;
typedef struct Token Token;
struct Token {
TokenKind kind;
Token* next;
int val;
char* str;
int len;
};
Token* new_token(TokenKind kind, T... |
C | //
// Created by 焦宏宇 on 2020/2/16.
//
#include "dynamic_array_max_heap.h"
#include <stdlib.h>
#include <stdio.h>
// 初始化堆 with capacity
dynamic_array_max_heap_t *dynamic_array_max_heap_c(int capacity, int element_size)
{
dynamic_array_max_heap_t *dynamic_array_max_h = (dynamic_array_max_heap_t *)malloc(sizeof(dyna... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.