language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include "../src/linkedlist.h"
int test_linkedlist_is_empty(void) {
s_linkedlist *linked_list = NULL;
int test_one = 0;
int test_two = 0;
unsigned int error = 0;
// Test
linked_list = linkedlist_create();
linkedlist_add_front(linked_list,... |
C | // Palette uploader.
//
// When a request to change palette arrives, 'requested_palette' is set to the requested palette number.
// Then, palette is uploaded to multiple boards when I2C bus becomes free, this is time-consuming.
// There is no queue for palette change commands,
// it is assumed that they are issued extr... |
C | #include<stdio.h>
int main() {
int x,y,z,i,j,k;
i = 1;j=2;k=3;
z = i-1 && j++ < k;
x = y = z -= 1;
++x && ++y && ++z;
printf("x=%d,y=%d,z=%d\n",x,y,z);
} |
C | //
// main.c
// hw2test
//
// Created by Elizabeth Han on 10/17/17.
// Copyright © 2017 Elizabeth Han. All rights reserved.
//
#include <stdio.h>
long cread(long*xp)
{
return (xp? *xp : 0);
}
/*int main(void) {
long x = 3;
long *y = &x;
long z = cread(y);
printf("%li \n", z);
... |
C | #include<stdio.h>
void main()
{
int a[] = {2,4,6,8,10},i,s = 0;
for(i=0;i<3;i++)
s += a[i+1];
printf("%d\n",s);
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
char tmap[64][64];
char flag[64][64][4];
char step[][2] = {
{0, 1},
{1, 0},
{0, -1},
{-1, 0},
};
int main() {
int tc, ti, n, r, i, x, y;
int nx, ny, d;
scanf("%d", &tc); for (ti=0; ti<tc; ti++) {
memset(tmap, 0, sizeof(tmap));
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include "jeu.h"
t_jeu* creer_jeu(char *nom, genre_jeu genre, int nbJoueurMin, int nbJoueurMax, int duree) {
t_jeu *jeu;
jeu = (t_jeu*)malloc(sizeof(t_jeu));
if (jeu == NULL) return NULL;
jeu->nom = nom;
jeu->genre = genre;
jeu->nbJoue... |
C | #include "u.h"
#include "libc.h"
/*
* first argument (l) is in r3 at entry.
* r3 contains return value upon return.
*/
int
tas(int *x)
{
int v;
/*
* this __asm__ works with gcc 2.95.2 (mac os x 10.1).
* this assembly language destroys r0 (0), some other register (v),
* r4 (x) and r5 (temp).
*/
__asm_... |
C | //************************************//
/*NAME: VARA ASHISH H.
TITLE: GENERATE FOLLOWING TASK USING INTERRUPT:
1) CREATING SQUARE WAVE ON P2.5
2) SENDING LATTER 'A' TO SERIAL PORT
3) GET SINGLE BIT FROM P1.7 AND SEND IT TO P1.0
DATE: 07/01/2014 */
//***********************************/... |
C | /* Writing/reading struct to disk */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#define FALSE 0
#define TRUE 1
struct account
{
int number;
char firstname[30];
char lastname[30];
float balance;
struct account *next;
};
struct account *first_ac = NULL;
stru... |
C | #include "MapsParse.h"
#include "ThreadControl.h"
/*
* 입력받은 메모리 영역에 값을 추출 합니다.
*/
void getValue(int mem_fd,long staMemAddr,long endMemAddr,void *buf){
//printf("getValue Function! - Start\n");
//printf("staMemAddr : %#lx, endMemAddr : %#lx\n",staMemAddr,endMemAddr);
for (; staMemAddr < endMemAddr; staMemAddr += ... |
C | /* Copyright 2017 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writi... |
C | /*************************************************************************
> File Name: seqtest.c
> Author: suziteng
> Mail: 253604653@qq.com
> Created Time: 2019年05月04日 星期六 10时11分16秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lst_dir.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "genericlist.h"
LIST slist;
int main()
{
int arr[10] = {11, 12, 13, 20, 30, 111, 987, 567, 876, 8796};
int i, *aa;
GLITER iter;
int *x = malloc(sizeof(int));
*x = 55;
gListInit(&slist, "G-SLIST");
for (i = 0; i < sizeof(arr)/sizeof(arr[0]); i++)
{
gListAddElem... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <omp.h>
#define I(i, j) ((N) * (i) + (j))
#define NUM_ITERATIONS 1000
#define N 2000
void stencil2D(double* G1, double* G2) {
for (size_t it = 0; it < NUM_ITERATIONS; it++) {
for (size_t i = 1; i < N - 1; i++) {
... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
void hacerTarea()
{
fprintf(stdout,"Mi PID es %d y el de mi padre %d\n", getpid(), getppid());
exit(0);
}
void main()
{
int i,pid;
fprintf(stdout,"Mi PID es el %d\n", getpid());
for (i = 0; i < 3; i++) {
pid = fork();
if (pid == 0)
hac... |
C | #include<stdio.h>
int main()
{
int arr[]={10,20,30,40,50};
int i=0,n=5,item=60,k=2;
printf("Original Array: \n");
for(i=0;i<n;i++)
{
printf("arr[%d]=%d \n", i, arr[i]);
}
arr[2]=item;
printf("Updated Array: \n");
for(i=0;i<n;i++)
{
printf("arr[%d]=%d \n", i, arr[i... |
C | #include <math.h>
#include "dft.h"
#define M_PI 3.14159265358979323846264338327950288
/* @brief original dft process per mathmatical formula
*
* Y[m] = sum { X[n] (cos(2 * PI * n * m / N) - jsin(2 * PI * n * m / N)) }
* X[n] = Real[2 * n] + jImag[2 * n]]
*
* Real(Y[m]) = y[2 * m] = x[2 * n] * cosf() + x[2 *... |
C | void controllo(int pipein) {
pos astronave, missile_left, missile_right, valore_letto;
astronave.x = -1;
missile_left.x = -1;
missile_right.x = -1;
do {
read(pipein, &valore_letto, sizeof(valore_letto)); /* leggo dalla pipe */
if (valore_letto.c == NAVICELLA) {
if (ast... |
C | #define _GNU_SOURCE
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#ifndef __NR_pidfd_open
#define __NR_pidfd_open 434 /* System call # on most architectures */
#endif
int
main(void)
{
pid_t self = getpid();
int pidfd = syscall(__NR_pidfd_open, self, 0)... |
C | #include <stdlib.h>
#include "ef_fd.h"
static PetscErrorCode set_second_order(ef_fd *fd)
{
PetscErrorCode ierr;
ierr = ef_stencil_create(&fd->first[-1], 3, 0);CHKERRQ(ierr);
ierr = ef_stencil_create(&fd->second[-1], 4, 0);CHKERRQ(ierr);
ierr = ef_stencil_create(&fd->first[0], 3, 1);CHKERRQ(ierr);
ierr = ef_st... |
C | #define BUFFERSIZE 10
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char buffer[BUFFERSIZE];
printf("Path is :%s", getenv("PATH"));
strcpy(buffer, getenv("USERNAME"));
printf("USERNAME is:%s\n", buffer);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* jyakdi.c :+: :+: :+: ... |
C | //
// Created by 浩然 on 2021/3/7.
//
#ifndef ALG_HEAP_H
#define ALG_HEAP_H
struct HeapStruct; //堆的定义
typedef struct HeapStruct *PriorityQueue;//优先级队列的定义
PriorityQueue Initialize(int MaxElements);//初始化
void Destroy(PriorityQueue H);//销毁
void MakeEmpty(PriorityQueue H);//清空
void Insert(ElememtType X, PriorityQueue H);//... |
C | #include "BST.h"
int main(){
tree root,tmp;
root = (nodeType*)malloc(sizeof(nodeType));
root=NULL;
tmp = (nodeType*)malloc(sizeof(nodeType));
insertNode(3, &root);
insertNode(6, &root);
insertNode(2, &root);
insertNode(9, &root);
insertNode(1, &root);
insertNode(5, &root);
insertNode(7, &root);
... |
C | //#define _CRT_SECURE_NO_WARNINGS 1
//#include <stdio.h>
//
////%2/2size_tܲĶƲͳ
//int number_one_bit1(size_t n)
//{
// int count = 0;
// while (n)
// {
// if (n % 2 == 1)
// count++;
// n /= 2;
// }
// return count;
//}
//
//
////>>&
//int number_one_bit2(int n)
//{
// int i = 0;
// int count = 0;
// for (i = 0; i <... |
C | /** \file
* \brief get/set callback
*
* See Copyright Notice in "iup.h"
*/
#include <stdlib.h>
#include <stdarg.h>
#include "iup.h"
#include "iup_object.h"
#include "iup_assert.h"
char* iupGetCallbackName(Ihandle *ih, const char *name)
{
void* value;
Icallback func = (Icallback)iupTableGetFunc(ih->attri... |
C | /* main.c */
/* Esempio d'uso di una lista concatenata */
#include <stdio.h>
#include "list.h"
int main(void)
{
List l;
list_init(&l);
/*
head ---> NULL
*/
printf("IsEmpty? %d\n", list_isEmpty(&l));
printf("Size: %d\n", list_size(&l));
list_print(&l);
putchar('\n');
/* a... |
C | /* getpid.c - getpid */
#include <conf.h>
#include <kernel.h>
#include <proc.h>
#include <lab0.h>
/*------------------------------------------------------------------------
* getpid -- get the process id of currently executing process
*------------------------------------------------------------------------
*/
S... |
C | //by Shashank Heda
//Calculation of an integral using Trapezoidal Rule using Parallel Programming
#include<stdio.h>
#include<math.h> // To incorporate usage of functions like sin, log etc.
#include<stdlib.h> // For the function exit(1)
#include "mpi.h" // To incorporate MPI Library
#include "mpe.h"
#d... |
C | /*
* Author: Lorenzo Tabasso, mat: 812499
* Author: Andrea Malgaroli, mat: 823429
*/
#include "sums.h"
#include "sorts.h"
#include "tests.h"
// COMPARE FUNCTIONS -----------------------------------------------------------
int compare_insertionsort(void* r1_p,void* r2_p){
long long first = (long long) r1_p;
... |
C |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<sys/wait.h>
#include<errno.h>
#include<fcntl.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#define S... |
C | /**
* Module: tools.c
* Author(s): Kristofer Hansson Aspman
*
* Description: Contains the functions to make
* the life of a motor control
* programmer easier.
*
*/
#define INT_TO_BITFIELD(a) *(msg_pointer)a
#define BITFIELD_TO_CHAR(a) *(unsigned char*)a
//NOTE: The follow... |
C | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
/**
* Return an array of arrays of size *returnSize.
* The sizes of the arrays are returned as *returnColumnSizes array.
* Note: Both returned array and *columnSizes ... |
C | #include <stdio.h>
#include <string.h>
int main()
{
int n, i, j, k;
char a[50];
scanf("%d", &n);
int x[n], y;
for(i = 1; i <= n; i++)
{
y = 0;
gets(a);
k = strlen(a);
for(j = 0; j < k; j++)
{
y = y + a[j];
}
x[i] = y;
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char *tmp = malloc(4);
int start = 20, lnum = 998765;
tmp[0] |= start;
tmp[1] |= lnum % (1 << 8);
tmp[2] |= lnum % (1 << 16) / (1 << 8);
tmp[3] |= lnum / (1 << 16);
for(int i = 0; i < 4; i++)
printf("%d ",tmp[i]);
printf("\n");
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "lib/encoding.h"
int
ctoi(char c){
// 0-9
if ( c >= 48 && c <= 57) return c - 48;
// A-F
if (c >= 65 && c <= 70) return c - 55;
}
int
main(int argc, char * argv[])
{
if ( argc != 4 ) {
printf("Usage: %s [issuer] [ac... |
C | #include "parse.h"
#include "wrap.h"
extern char *cwd;
FILE *configfp=NULL;
static FILE *getfp(char *path)
{
configfp=Fopen(path,"r");
return configfp;
}
static char* getconfig(char* name)
{
/*
pointer meaning:
...port...=...8000...
| | | | |
*fs | | | *be f->forward b-> back
*fe | *b... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
//#include"league_inter.c"
/*void swap(int a,int b)
{
int temp;
temp=a;
a=b;
b=temp;
}*/
int run(int *count)
{
int a[11],i,m=0,f=0,c=0,c1=0,f1=0,f2=0,choice;
int n,s[11]={0},balls,overs,over=0,total=0,b[20]={0};
float str,rrt;
printf("\n Enter the number ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <termios.h>
#include <string.h>
struct Node {
char name[100];
char nickName[100];
char id[100];
char password[100];
double point;
int rank;
int state;
struct Node* next;
};
struct Words {
char eng[1... |
C | #define _CRT_SECURE_NO_WARNINGS // scanf
#include <stdio.h>
int main()
{
int count;
scanf("%d", &count); // Է¹
for (; count > 0; count--) // ʱ갪 scanf ҽѼ ݺ
{
printf("Hello, world! %d\n", count);
}
return 0;
}
|
C | #ifndef SUPPORT_H
#define SUPPORT_H
#define PI 3.14159265358979323846
#include <cmath>
// return radians - same way as asin() of <cmath>
double myAsin(double sinAlpha, double cosAlpha)
{
if (sinAlpha > 0.) {
if (cosAlpha > 0.) {
return asin(sinAlpha);
} else {
return PI - asin(sinAlpha);
}
... |
C | #include <stdio.h>
char *secret = "password";
void shell()
{
char *shell = "/bin/sh";
char *cmd[] = { "/bin/sh", 0 };
printf("The Force Is Strong With You\n");
//setreuid(0);
execve(shell,cmd,0);
}
int authorization()
{
char password[64];
printf("Enter Password: ");
gets(password);
if (!strcmp(password,sec... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
/*this is for stack */
typedef struct st{
int data;
struct st *next;
}stack;
/*these are for queue*/
typedef struct qu{
int data;
struct qu *next;
}node_t;
typedef struct{
node_t *frontp;
node_t *rearp;
int size;
}queue;
/*this is for b... |
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 | #include <common.h>
static queue_st q;
static queue_item_st items[100];
void test_queue()
{
int i;
for (i = 0; i < 100; ++i) {
items[i].p = (void *)(intptr_t)i;
}
queue_init(&q, "test");
queue_push(&q, &items[0]);
assert(queue_pop(&q) == &items[0]);
assert(queue_pop(&q) == NULL);... |
C | <<<<<<< HEAD
#include <stdio.h>
int main()
{
int A,B,C,maior;
scanf(" %i", &A);
scanf(" %i", &B);
scanf(" %i", &C);
if(A > B && A > C)
{
maior = A;
}
else
{
if(B > A && B > C)
{
maior = B;
}
else
{
maior = C;
... |
C | // Simulado para a prova p1.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//funcoes
void push();
void mostrar();
void pop();
//variaveis globais
int topo=0;
int pilha[31];
int entrada;
int i=0, c, qtd=0;
//main
int main(){
for(i=0; i<5;i++){
scanf("%d", &entrada);
if(entrada%2==0){
push()... |
C | // UTMSPACE_2018-2019-sem2_SCSJ1013_Programming_Techniques_I
// SX180357CSJS04
// Randy Tan Shaoxian
// Algorithm for the program: total_cost_of_apples
// 1. Begin.
// 2. Read in the value for the amount in kg of the apples, store it in amount.
// 3. Read in the value for the cost per kg of the apples in RM, st... |
C |
#include <core/shader.h>
#include <string.h>
#include <memory.h>
struct Shader_s {
GLuint _program;
GLuint _handles[MAX_SHADERS];
char* _srcs[MAX_SHADERS];
};
CENGINE_API SHADER* CENGINE_CALL new_shader_f(const char* vs_path, const char* fs_path)
{
SHADER* shader = new_shader();
if (MAX_SHAD... |
C | #ifndef __STM8S_ENCODER_C
#define __STM8S_ENCODER_C
#include "inc/stm8s_encoder.h"
void EncoderInit(encoder_t* encod,
GPIO_TypeDef* GPIOx_A, GPIO_Pin_TypeDef GPIO_PIN_A,
GPIO_TypeDef* GPIOx_B, GPIO_Pin_TypeDef GPIO_PIN_B,
int32_t cnt,int32_t boost_max,uint16_t period_max )
{
/*
encod->... |
C | #include "dataplane/iface.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
interface *iface_h1_sw, *iface_h2_sw;
interface * initialize_interface(char *name) {
interface *iface = malloc(sizeof(in... |
C | #define _POSIX_C_SOURCE 200809
#include <stdio.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
int main(void) {
int fd = open("/dev/dri/card0", O_RDONLY);
if (!fd) {
perror("open(\"/dev/dri/card0\")");
return 1;
}
struct f... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,j,y,t[100],tab[100];
do{
printf("Donner la Taille du tableau : \n");
scanf("%d",&n);
}while (((n%2)!=0)|| (n<1));
for(i=0;i<n;i++){
printf("Case[%d] : ",i);
scanf("%d",&t[i]);
t[i+1]=t[i];
i++... |
C | #include <stdio.h>
int main()
{
int n, cnt = 0;
char s[101];
scanf("%d", &n);
scanf("%s", s);
for(int i = 0; i < n; ++i) {
cnt += s[i] == '8';
}
int ans = cnt;
if(ans > n / 11) {
ans = n / 11;
}
printf("%d\n", ans);
return 0;
}
|
C | /* to compile: gcc -o CPacking CPacking.c
* to run: ./CPacking
*/
#include <stdio.h>
int main() {
int a;
short b;
short c;
printf("%x int a\n", &a);
printf("%x short b\n", &b);
printf("%x short c\n", &c);
}
|
C | /*
* Sort01.c
* sorting an array of 0's and 1's
* Created on: May 4, 2014
* Author: Venkata
*/
void sort01(int *arr, int n)
{
int left=0, right=n-1, temp;
while(left < right) {
//see the problem if you leave it with arr[left] below ?
//say if there are only 0's in the arr!
while(arr[left] == 0 &&... |
C | /*
* PWMControl.c
*
* Created on: Jul 9, 2020
* Author: raing
*/
#include "main.h"
uint32_t IC_Value1 = 0;
uint32_t IC_Value2 = 0;
uint32_t Difference = 0;
uint32_t Frequency = 0;
uint8_t Is_First_Captured = 0; // 0- not captured, 1- captured
bool NewDiffAvailable = false;
void start_pwm1(int onTimemSec)
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../utils/getline_debug.c"
#include "../utils/strlist.c"
typedef struct nlist
{
struct nlist *next;
char *name;
char *defn;
} nlist;
#define HASHSIZE 101
static nlist *hashtab[HASHSIZE];
nlist *install(char *, char *);
unsigned hash(char *);
... |
C | #define M_SIZE 0x8000
#define P 6
char f1(int i) {
return i % 26 + 'A';
}
char f2(int i) {
return i%26 + 'a';
}
char f0(int i) {
return i*0;
}
void fill(char *arr, char (*func)(int)) {
int i;
for (i = 0; i < M_SIZE; i++) {
arr[i] = func(i);
}
//verify(arr,func);
return;
}
int handle;
int verify(char *a... |
C | /**Vincenzo Petrolo s256499*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define __NOMEFILE__ "corse.txt"
#define __LOGFILE__ "log.txt"
#define __N_COMANDI__ 7
#define __MAX_S__ 31
#define __MAX_DATI__ 1000
typedef enum{r_date,r_tratte,r_partenza,r_capolinea,r_ricerca,r_stampa,r_fi... |
C | /* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <err.h>
#include <string.h>
#include "util.h"
static xcb_connection_t *conn;
static xcb_screen_t *scrn;
static xcb_atom_t atom;
static void
usage(char *name) {
fprintf(stderr, "usage: %s <... |
C | /******************************************************************************
FILENAME: Cordic.c
*****************************************************************************
Public domain module
Adaption: Gerard Gauthier
Author: J. Pitts Jarvis III (+), 3Com Corporation, October 1990
... |
C | #include<stdio.h>
int main()
{
int i;
int num = 6;
int product = 1;
for(i=1 ; i<=num ; i++) product += i;
printf("Factorial of %d is %d\n", num, product);
}
|
C | /**
* Student.C
* CS 3505
* Authors: Landon Gilbert-Bland and Alex Clemmer
* Date: Spring 2011
*
* Defines member functions of Student.h
*/
#include <stdlib.h>
#include <iostream>
#include "Student.h"
#include "Helpers.h"
using namespace std;
string Student::toString() {
string result = name + "," + level + ... |
C | #ifndef LZ4_H_
#define LZ4_H_
//******************************************************************************
//
//! \addtogroup lz4_api
//! @{
//
//******************************************************************************
//*****************************************************************************
//
// If ... |
C | #include <stdio.h>
int get_sum_of_array(int rows,int array[rows]){
int i,sum=0;
for (i=0;i < rows;i++){
sum += array[i];
}
return sum;
}
int main (void){
int numbers[10] = {0,1,2,3,4,5,6,7,8,9};
printf("The sum of the array is %i.",get_sum_of_array((sizeof(numbers)/sizeof(numbers[0])),numbers));
}
|
C | #include <png.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#define QUIET
char *color_type_string(int color_type) {
switch (color_type) {
case PNG_COLOR_TYPE_GRAY:
return "PNG_COLOR_TYPE_GRAY";
case PNG_COLOR_TYPE_GRAY_ALPHA:
return "PNG_COLOR_TYPE_GRAY_ALPHA";
... |
C |
#include <wchar.h>
wchar_t *
wcspbrk(s, set)
const wchar_t *s;
const wchar_t *set;
{
const wchar_t *p;
const wchar_t *q;
p = s;
while (*p) {
q = set;
while (*q) {
if (*p == *q) {
/* LINTED interface specification */
return (wchar_t *)p;
}
q++;
}
p++;
}
return... |
C | /* program to print all the even numbers except those which are multiple of either 3 or 5 */
#include<stdio.h>
int main()
{
for(int i=1;i<100;i++)
{
if((i%2==0)&&(i%3!=0)&&(i%5!=0))
printf("%d\n",i);}}
|
C | /*
Name: Paul Talaga
Date: March 6, 2018
Desc: Shapes assignment
*/
#include <stdio.h>
int main(){
srand(time(0));
printf("1. Filled-in rectangle\n");
printf("2. Rectangle frame\n");
printf("3. Rectangle frame with alternating interior\n");
printf("4. Square with alternating interior\n");
printf("5. Recta... |
C | /*
** matrix.c for doom in /home/petren_l/rendu/tek1/semestre_01/doom/src
**
** Made by Ludovic Petrenko
** Login <petren_l@epitech.net>
**
** Started on Mon Jan 11 17:43:32 2016 Ludovic Petrenko
** Last update Wed Jan 27 08:20:27 2016 Luka Boulagnon
*/
#include "tekdoom.h"
void mtx_clear(double *m)
{
m[0] = 1... |
C | #pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
void read_file(char *n, struct Sales x[], int *s);
void print_biggest_sale(struct Sales k[], int numrecords);
int compare(struct Sales k[], char *buffer, int numrecords, int *s);
void get_file_name(char *n);
void save_records(struct Sales k[], int nu... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_util.c :+: :+: :+: ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int fib(int m)
{
int f3 = 0;
if( 1 == m || 2 == m)
return 1;
else
{
int f1 = 1;
int f2 = 1;
int i = 0;
for(i = 3; i<=m; i++)
{
f3 = f2 + f1;
f1 = f2;
f2 = f3;
}
}
return f3;
} |
C | /*
Program acts as a system GPIB controller using USB.
This is binary version.
Command syntax:
IB<CR>
Powers on.
Returns: <ACK>
IBC<cmd><CR> or IBc<cmd><CR>
Sends <cmd> byte as bus command.
C: Releases ATN, c: does not release ATN.
Returns: <ACK>, 1, 2, 8
IB<DLE><STX><data bytes><DLE><ETX>
Sends data.... |
C | #include <stdio.h>
#if 0
main()
{
FILE *fp;
char ch, filename[50];
printf("Please input filename:\n");
scanf("%s",filename);
if((fp = fopen(filename,"w"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
printf("Please input paragarm(#end):\n");
ch = getchar();
while(ch!='#')
{
fputc(ch,fp);//һַд뵽ȥ ... |
C | #include <stdio.h>
int main(void)
{
int base = 0;
int count = 0;
printf("pls input a base_number:\n");
scanf("%d",&base);
while(base)
{
base /= 10;
count++;
}
printf("count = %d\n",count);
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
void lerElementos(int *arr, int n);
int main(){
int n;
do{
printf("Digite o tamanho de n: ");
scanf("%d", &n);
}while(n <= 0);
int *arr = (int*)calloc(n, sizeof(int));
if(arr == NULL){
printf("Mmoria insuficiente");
... |
C | #include "imei.h"
void yapiciFonksiyon2(struct IMEI * Imei)
{
Imei->imei=malloc(sizeof(int)*15);
}
void ImeiOlustur(struct IMEI * Imei)
{
int i,r ;
for (i = 0; i < 14; i++) //14 haneye random rakam atarız
{
r=rand()%10;
Imei->imei[i]=r;
}
int tekTop=0,ciftler=0;
for... |
C | #include "shell.h"
int (*builtin_f[]) (char **) = { &help, &cd};
/* char *builtin[] = { "help", "cd"}; */
/**
*Fork - wrapper function for fork.
*Return: process created.
*/
pid_t Fork(void)
{
pid_t pid = fork();
if (pid < 0)
perror("Fork error");
return (pid);
}
/**
* num - Calculates the number of b... |
C | /*Substitui ocorrncia*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define TAM 1000
struct list {
char ch;
struct list *P;
};
typedef struct list Lista;
Lista *insere (Lista *,char *);
void imprime (Lista *);
Lista *clona (Lista *);
unsigned int tamanho (Lista *);
Lista *subst... |
C | /*
Tickle class library
Copyright (c) 2003,2004 Alessandro Scotti
*/
#ifndef EMU_BLITTER_H_
#define EMU_BLITTER_H_
struct TBitBlitter
{
virtual ~TBitBlitter () {
}
virtual void blit( unsigned char * dst, unsigned char * src, int len ) = 0;
};
struct TBltCopy : public TBitBlit... |
C | /*
apl compiler
build new parse tree nodes
timothy a. budd
*/
/*
The APL Compiler is Public Domain
It may be freely redistributed as long as this notice of authorship
is retained with the sources.
Tim Budd
Oregon State University
Department of Computer Science
Corvallis, Oregon 97331 USA
No guarant... |
C | // Generate a power-on reset pulse using an attiny84.
#include <avr/interrupt.h>
#define F_CPU 800000UL
#include <util/delay.h>
#include <stdint.h>
// GPIOs on port A
// Pin 0 is the reset output.
// Pin 1 is the momentary normally open manual reset button:
// when the button is pressed, pin 1 is connected to ground... |
C | /**----------------------------------------------------------
Base64 Encoder-Decoder
Main file
-------------------------------------------------------------*/
#include "base64.h"
/**----------------
Main function.
It just handle the file management and the memory allocation part,
creating the strings that the ... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "prac2funs_1.h"
#include "prac2funs_2.h"
/* AUTOR: Astor Prieto, niUB: 16445586, DNI: 39427935R */
double f(double x) {
double f;
f = pow(sin(y), 2);
return f;
}
double F(double x) {
int N, nMax;
double T_n = 0;
double T_aux... |
C | // ʵֺ ToLowerCase()úһַ strַеĴдĸתСдĸ֮µַ
// ʾ 1
// : "Hello"
// : "hello"
// ʾ 2
// : "here"
// : "here"
// ʾ?3
// : "LOVELY"
// : "lovely"
char * toLowerCase(char * str){
char* ret = str;
while (*str != '\0')
{
if (*str <= 'Z' && *str >= 'A')
*str += 32;
str++;
}
return ret;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef char element[100];
typedef struct ListNode{
element data;
struct ListNode *link;
} ListNode;
typedef struct CListType{
ListNode *head;
}CListType;
//Ʈ
void print_list(CListType *L){
ListNode *p;
if(L->head ==NULL) return;
p = L->head->link;
do{
... |
C | //
// Created by greg on 2021-07-30.
//
#include "lang.h"
#include <assert.h>
// region ------------------- SHADING ---------------
// todo: spot light is done by comparing the angle (dot prod) between light dir an vec from light to fragment
// https://www.lighthouse3d.com/tutorials/glsl-tutorial/spotlights/
publi... |
C | #include <stdio.h>
int main(void)
{
int n = 0, min = 0, max = 0, sub = 0;
int a[1001] = { 0, };
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
min = max = a[0];
for (int j = 0; j < n; j++)
{
if (a[j] > max)
max = a[j];
else if
(a[j] < min)
min = a[j];
}
sub = max ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* draw.c :+: :+: :+: ... |
C | #include <stdio.h>
int main()
{
double KRW, exchange_rate;
printf("KRW : ");
scanf_s("%lf", &KRW);
printf("원/달러 환율 : ");
scanf_s("%lf", &exchange_rate);
printf("KRW %.2lf = USD %.2lf", KRW, KRW / exchange_rate);
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h> // rand
#include <time.h> // time
#include <assert.h> // assert
#define SUIT_NUM 2 // F6
#define NUMBER_NUM 10 // F10
#define MAX_CARD (SUIT_NUM * NUMBER_NUM)
#define MAX_LINE 9 // line̐
#define MAX_MEMBER 3 // 1C̏l
#define MAX_HAND 7 // D
#define PLAYER1 0 //
#defin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#define EXT ".rle"
char* getNewFilename(char *filename) {
int ext_len = strlen(EXT);
int fin_len = strlen(filename);
char *fout_name = malloc((fin_len + ext_len + 1) * sizeof(char));
//add ".rle" plus null te... |
C | #ifndef __VECTOR2_H
#define __VECTOR2_H
/** @defgroup vector2 vector2
* @{
* 2 Dimensional vector struct and functions
* Notes:
* -the funcs v2_equal and normalizeRef use epsilon. be careful.
* -every vector2 func starts as "v2"
* */
/**
* 2 dimensional vector
*/
typedef struct vector2d{
float x;///<x co... |
C | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
// generate the polinomial
void generatePolinomial(int *a, int k, int s, int nbits) {
// a0 = secret
a[0] = s;
int i, max = (int)pow(2, nbits);
// find the other k-1 random numbers
for(i = 1; i < k; i++) {
a[i] = rand() % max;
}
}
void generatePoints(in... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* itoa_base.c :+: :+: :+: ... |
C | // LevelHelpers.h - a few handy tools to ease using levels.
// The important thing is the XXXPos functions, which convert
// image positions from one level to another. Use these whenever
// transforming positions to ensure consistent operation!!
#ifndef __LEVEL_HELPERS_H
#define __LEVEL_HELPERS_H
#define EIGEN_DONT_AL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.